From fb4fb5428d50d3d0c092a60f5ef4410f250ed2c4 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 3 Nov 2001 09:05:11 +0000 Subject: Update. 2001-11-02 Jakub Jelinek * 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. --- string/bits/string2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'string/bits') 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) \ { \ -- cgit v1.2.3