-wtf
authorChristian Grothoff <christian@grothoff.org>
Tue, 13 Nov 2012 00:22:35 +0000 (00:22 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 13 Nov 2012 00:22:35 +0000 (00:22 +0000)
src/util/common_allocation.c

index 1828d826a5a24a4355f92b0b6dd528adc6219f83..22dfb2509c3538fc459c9fac07538f4b15b930e0 100644 (file)
@@ -272,7 +272,7 @@ GNUNET_xstrndup_ (const char *str, size_t len, const char *filename,
   char *res;
 
   GNUNET_assert_at (str != NULL, filename, linenumber);
-  len = GNUNET_MIN (len, strlen (str));
+  len = strnlen (str, len);
   res = GNUNET_xmalloc_ (len + 1, filename, linenumber);
   memcpy (res, str, len);
   /* res[len] = '\0'; 'malloc' zeros out anyway */