summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormillert <>2003-05-09 20:01:43 +0000
committermillert <>2003-05-09 20:01:43 +0000
commit583976a4c4c5bbc108417c5ae5b35108e3feb2a6 (patch)
tree445f162f6659c4a651e31eed999e6872f1e17525 /src
parent48e8f2a93f67f8ed59ce9a92eae6e88865d55936 (diff)
downloadopenbsd-583976a4c4c5bbc108417c5ae5b35108e3feb2a6.tar.gz
openbsd-583976a4c4c5bbc108417c5ae5b35108e3feb2a6.tar.bz2
openbsd-583976a4c4c5bbc108417c5ae5b35108e3feb2a6.zip
Pass ndigit+1 as size arg to strlcpy() since ndigit doesn't include the NUL
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/stdlib/gcvt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/gcvt.c b/src/lib/libc/stdlib/gcvt.c
index fda487d729..240c4db5b0 100644
--- a/src/lib/libc/stdlib/gcvt.c
+++ b/src/lib/libc/stdlib/gcvt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gcvt.c,v 1.2 2003/04/02 02:43:50 millert Exp $ */ 1/* $OpenBSD: gcvt.c,v 1.3 2003/05/09 20:01:43 millert Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char rcsid[] = "$OpenBSD: gcvt.c,v 1.2 2003/04/02 02:43:50 millert Exp $"; 31static char rcsid[] = "$OpenBSD: gcvt.c,v 1.3 2003/05/09 20:01:43 millert Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdio.h> 34#include <stdio.h>
@@ -51,7 +51,7 @@ gcvt(double value, int ndigit, char *buf)
51 digits = __dtoa(value, 2, ndigit, &decpt, &sign, NULL); 51 digits = __dtoa(value, 2, ndigit, &decpt, &sign, NULL);
52 if (decpt == 9999) { 52 if (decpt == 9999) {
53 /* Infinity or NaN, assume buffer is at least ndigit long. */ 53 /* Infinity or NaN, assume buffer is at least ndigit long. */
54 strlcpy(buf, digits, ndigit); 54 strlcpy(buf, digits, ndigit + 1);
55 return (buf); 55 return (buf);
56 } 56 }
57 57