summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/gcvt.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-05-09 20:01:43 +0000
committermillert <millert@openbsd.org>2003-05-09 20:01:43 +0000
commit5bbd093dd8ea8f0b6ead668dd925a8ce679380a5 (patch)
treef1dd30136055f7d6604511685c25629814c4a914 /lib/libc/stdlib/gcvt.c
parentassembler versions of insque and remque for m68k, also from 4.4BSD (diff)
downloadwireguard-openbsd-5bbd093dd8ea8f0b6ead668dd925a8ce679380a5.tar.xz
wireguard-openbsd-5bbd093dd8ea8f0b6ead668dd925a8ce679380a5.zip
Pass ndigit+1 as size arg to strlcpy() since ndigit doesn't include the NUL
Diffstat (limited to 'lib/libc/stdlib/gcvt.c')
-rw-r--r--lib/libc/stdlib/gcvt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdlib/gcvt.c b/lib/libc/stdlib/gcvt.c
index fda487d729a..240c4db5b06 100644
--- a/lib/libc/stdlib/gcvt.c
+++ b/lib/libc/stdlib/gcvt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gcvt.c,v 1.2 2003/04/02 02:43:50 millert Exp $ */
+/* $OpenBSD: gcvt.c,v 1.3 2003/05/09 20:01:43 millert Exp $ */
/*
* Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: gcvt.c,v 1.2 2003/04/02 02:43:50 millert Exp $";
+static char rcsid[] = "$OpenBSD: gcvt.c,v 1.3 2003/05/09 20:01:43 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -51,7 +51,7 @@ gcvt(double value, int ndigit, char *buf)
digits = __dtoa(value, 2, ndigit, &decpt, &sign, NULL);
if (decpt == 9999) {
/* Infinity or NaN, assume buffer is at least ndigit long. */
- strlcpy(buf, digits, ndigit);
+ strlcpy(buf, digits, ndigit + 1);
return (buf);
}