diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-12-14 18:51:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-12-14 18:51:10 +0000 |
commit | 0f16f15060952ceae16cf6e321b161b8793eed3c (patch) | |
tree | d917bc7db9df014fd42596dab654e2513788a310 /src/util/common_allocation.c | |
parent | 047a1fc2bf4fac55aed53128b57800fe6b25688b (diff) | |
download | gnunet-0f16f15060952ceae16cf6e321b161b8793eed3c.tar.gz gnunet-0f16f15060952ceae16cf6e321b161b8793eed3c.zip |
-allow NULL if n=0
Diffstat (limited to 'src/util/common_allocation.c')
-rw-r--r-- | src/util/common_allocation.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 89be027e7..dfa65d579 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c | |||
@@ -286,6 +286,8 @@ GNUNET_xstrndup_ (const char *str, size_t len, const char *filename, | |||
286 | { | 286 | { |
287 | char *res; | 287 | char *res; |
288 | 288 | ||
289 | if (0 == len) | ||
290 | return GNUNET_strdup (""); | ||
289 | GNUNET_assert_at (str != NULL, filename, linenumber); | 291 | GNUNET_assert_at (str != NULL, filename, linenumber); |
290 | len = strnlen (str, len); | 292 | len = strnlen (str, len); |
291 | res = GNUNET_xmalloc_ (len + 1, filename, linenumber); | 293 | res = GNUNET_xmalloc_ (len + 1, filename, linenumber); |