Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libutil - use the correct buffer size
details: https://anonhg.NetBSD.org/src/rev/77bc8a6f130d
branches: trunk
changeset: 769180:77bc8a6f130d
user: christos <christos%NetBSD.org@localhost>
date: Fri Sep 02 10:13:44 2011 +0000
description:
- use the correct buffer size
- remove obsolete comment
diffstat:
lib/libutil/strpct.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diffs (35 lines):
diff -r d8e784f94e18 -r 77bc8a6f130d lib/libutil/strpct.c
--- a/lib/libutil/strpct.c Fri Sep 02 10:11:43 2011 +0000
+++ b/lib/libutil/strpct.c Fri Sep 02 10:13:44 2011 +0000
@@ -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);
}
Home |
Main Index |
Thread Index |
Old Index