diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-01-06 21:22:23 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-01-06 21:22:23 +0100 |
commit | 6532ac1037b448508642d4d97d21ab103bd6735c (patch) | |
tree | e341bfbc88da6cd1ca8f7c528164411082f1f49f | |
parent | 8dea30580ceaa571c9d85b5e8a563201ed622ed7 (diff) | |
download | gnunet-6532ac1037b448508642d4d97d21ab103bd6735c.tar.gz gnunet-6532ac1037b448508642d4d97d21ab103bd6735c.zip |
internally assert that asprintf size allocation never fails
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 7 | ||||
-rw-r--r-- | src/util/common_allocation.c | 1 | ||||
-rw-r--r-- | src/util/configuration.c | 1 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index c5d6e6d34..8b00543c3 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -3351,9 +3351,10 @@ handle_tcp_data (void *cls, | |||
3351 | void *vaddr = NULL; | 3351 | void *vaddr = NULL; |
3352 | size_t alen; | 3352 | size_t alen; |
3353 | 3353 | ||
3354 | GNUNET_SERVER_client_get_address (client, | 3354 | GNUNET_assert (GNUNET_OK == |
3355 | &vaddr, | 3355 | GNUNET_SERVER_client_get_address (client, |
3356 | &alen); | 3356 | &vaddr, |
3357 | &alen)); | ||
3357 | LOG (GNUNET_ERROR_TYPE_ERROR, | 3358 | LOG (GNUNET_ERROR_TYPE_ERROR, |
3358 | "Received unexpected %u bytes of type %u from `%s'\n", | 3359 | "Received unexpected %u bytes of type %u from `%s'\n", |
3359 | (unsigned int) ntohs (message->size), | 3360 | (unsigned int) ntohs (message->size), |
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index be2538c3f..80047bb52 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c | |||
@@ -484,6 +484,7 @@ GNUNET_asprintf (char **buf, | |||
484 | va_start (args, format); | 484 | va_start (args, format); |
485 | ret = VSNPRINTF (NULL, 0, format, args); | 485 | ret = VSNPRINTF (NULL, 0, format, args); |
486 | va_end (args); | 486 | va_end (args); |
487 | GNUNET_assert (ret >= 0); | ||
487 | *buf = GNUNET_malloc (ret + 1); | 488 | *buf = GNUNET_malloc (ret + 1); |
488 | va_start (args, format); | 489 | va_start (args, format); |
489 | ret = VSPRINTF (*buf, format, args); | 490 | ret = VSPRINTF (*buf, format, args); |
diff --git a/src/util/configuration.c b/src/util/configuration.c index 7f1d98902..25eeaf80f 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -421,7 +421,6 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
421 | size_t m_size; | 421 | size_t m_size; |
422 | size_t c_size; | 422 | size_t c_size; |
423 | 423 | ||
424 | |||
425 | /* Pass1 : calculate the buffer size required */ | 424 | /* Pass1 : calculate the buffer size required */ |
426 | m_size = 0; | 425 | m_size = 0; |
427 | for (sec = cfg->sections; NULL != sec; sec = sec->next) | 426 | for (sec = cfg->sections; NULL != sec; sec = sec->next) |