diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
commit | d8c53b12a818ff7cf82d06a1a69c395bdef85ee6 (patch) | |
tree | 0ebb0db416c157fcfde51a941185819dd12d51fd /src/util/configuration.c | |
parent | 5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff) | |
download | gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.tar.gz gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.zip |
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/util/configuration.c')
-rw-r--r-- | src/util/configuration.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c index 0ddb4fb2f..bc5fd3abd 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -432,7 +432,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
432 | { | 432 | { |
433 | len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name); | 433 | len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name); |
434 | GNUNET_assert (0 < len); | 434 | GNUNET_assert (0 < len); |
435 | memcpy (mem + c_size, cbuf, len); | 435 | GNUNET_memcpy (mem + c_size, cbuf, len); |
436 | c_size += len; | 436 | c_size += len; |
437 | GNUNET_free (cbuf); | 437 | GNUNET_free (cbuf); |
438 | for (ent = sec->entries; NULL != ent; ent = ent->next) | 438 | for (ent = sec->entries; NULL != ent; ent = ent->next) |
@@ -449,12 +449,12 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
449 | } | 449 | } |
450 | len = GNUNET_asprintf (&cbuf, "%s = %s\n", ent->key, val); | 450 | len = GNUNET_asprintf (&cbuf, "%s = %s\n", ent->key, val); |
451 | GNUNET_free (val); | 451 | GNUNET_free (val); |
452 | memcpy (mem + c_size, cbuf, len); | 452 | GNUNET_memcpy (mem + c_size, cbuf, len); |
453 | c_size += len; | 453 | c_size += len; |
454 | GNUNET_free (cbuf); | 454 | GNUNET_free (cbuf); |
455 | } | 455 | } |
456 | } | 456 | } |
457 | memcpy (mem + c_size, "\n", 1); | 457 | GNUNET_memcpy (mem + c_size, "\n", 1); |
458 | c_size ++; | 458 | c_size ++; |
459 | sec = sec->next; | 459 | sec = sec->next; |
460 | } | 460 | } |
@@ -1291,7 +1291,7 @@ GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cf | |||
1291 | dup = expand_dollar (cfg, dup, 0); | 1291 | dup = expand_dollar (cfg, dup, 0); |
1292 | len = strlen (dup) + 1; | 1292 | len = strlen (dup) + 1; |
1293 | orig = GNUNET_realloc (orig, i + len); | 1293 | orig = GNUNET_realloc (orig, i + len); |
1294 | memcpy (orig + i, dup, len); | 1294 | GNUNET_memcpy (orig + i, dup, len); |
1295 | GNUNET_free (dup); | 1295 | GNUNET_free (dup); |
1296 | } | 1296 | } |
1297 | return orig; | 1297 | return orig; |