Module Name:    src
Committed By:   christos
Date:           Fri Sep  2 10:13:44 UTC 2011

Modified Files:
        src/lib/libutil: strpct.c

Log Message:
- use the correct buffer size
- remove obsolete comment


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libutil/strpct.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libutil/strpct.c
diff -u src/lib/libutil/strpct.c:1.1 src/lib/libutil/strpct.c:1.2
--- src/lib/libutil/strpct.c:1.1	Sun Aug 28 03:45:14 2011
+++ src/lib/libutil/strpct.c	Fri Sep  2 06:13:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: strpct.c,v 1.1 2011/08/28 07:45:14 christos Exp $ */
+/* $NetBSD: strpct.c,v 1.2 2011/09/02 10:13:44 christos Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: strpct.c,v 1.1 2011/08/28 07:45:14 christos Exp $");
+__RCSID("$NetBSD: strpct.c,v 1.2 2011/09/02 10:13:44 christos Exp $");
 
 #include <stdint.h>
 #include <locale.h>
@@ -56,7 +56,6 @@
 	uintmax_t factor, result;
 	size_t u;
 
-	/* I should check for digit overflow here, too XXX */
 	factor = 100;
 	for (u = 0; u < digits; u++) {
 		/* watch out for overflow! */
@@ -84,7 +83,7 @@
 	else {
 		factor /= 100;		/* undo initialization */
 
-		(void)snprintf(buf, sizeof(buf), "%ju%s%0*ju",
+		(void)snprintf(buf, bufsiz, "%ju%s%0*ju",
 		    result / factor, localeconv()->decimal_point, (int)u,
 		    result % factor);
 	}       

Reply via email to