summary refs log tree commit diff
path: root/string/bits
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-11-03 09:05:11 +0000
committerUlrich Drepper <drepper@redhat.com>2001-11-03 09:05:11 +0000
commitfb4fb5428d50d3d0c092a60f5ef4410f250ed2c4 (patch)
tree5729b64ff57a4aa16283a7f2904c7acba8fca711 /string/bits
parent5f73e77144a76a585f108c971e6c7aa5c9008944 (diff)
downloadglibc-fb4fb5428d50d3d0c092a60f5ef4410f250ed2c4.tar.gz
glibc-fb4fb5428d50d3d0c092a60f5ef4410f250ed2c4.tar.xz
glibc-fb4fb5428d50d3d0c092a60f5ef4410f250ed2c4.zip
Update.
2001-11-02  Jakub Jelinek  <jakub@redhat.com>

	* string/bits/string2.h (__strndup): If n is smaller than len, set
	len to n + 1.
	* string/tester.c (test_strndup): New function.
	(main): Call it.

	* sunrpc/rpc_main.c: Optimize variable definitions a bit.
Diffstat (limited to 'string/bits')
-rw-r--r--string/bits/string2.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/string/bits/string2.h b/string/bits/string2.h
index aafb578915..e8ac063e03 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -1216,7 +1216,7 @@ extern char *__strndup (__const char *__string, size_t __n)
 			  size_t __n = (n);				      \
 			  char *__retval;				      \
 			  if (__n < __len)				      \
-			    __len = __n;				      \
+			    __len = __n + 1;				      \
 			  __retval = (char *) malloc (__len);		      \
 			  if (__retval != NULL)				      \
 			    {						      \