Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libprop kill sprintf
details: https://anonhg.NetBSD.org/src/rev/4b299b93cf04
branches: trunk
changeset: 328120:4b299b93cf04
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 26 18:12:46 2014 +0000
description:
kill sprintf
diffstat:
common/lib/libprop/prop_number.c | 8 +++++---
common/lib/libprop/prop_string.c | 6 +++---
2 files changed, 8 insertions(+), 6 deletions(-)
diffs (50 lines):
diff -r 198ccb19949e -r 4b299b93cf04 common/lib/libprop/prop_number.c
--- a/common/lib/libprop/prop_number.c Wed Mar 26 18:11:26 2014 +0000
+++ b/common/lib/libprop/prop_number.c Wed Mar 26 18:12:46 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prop_number.c,v 1.25 2013/10/18 18:26:20 martin Exp $ */
+/* $NetBSD: prop_number.c,v 1.26 2014/03/26 18:12:46 christos Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -199,9 +199,11 @@
* we output in decimal.
*/
if (pn->pn_value.pnv_is_unsigned)
- sprintf(tmpstr, "0x%" PRIx64, pn->pn_value.pnv_unsigned);
+ snprintf(tmpstr, sizeof(tmpstr), "0x%" PRIx64,
+ pn->pn_value.pnv_unsigned);
else
- sprintf(tmpstr, "%" PRIi64, pn->pn_value.pnv_signed);
+ snprintf(tmpstr, sizeof(tmpstr), "%" PRIi64,
+ pn->pn_value.pnv_signed);
if (_prop_object_externalize_start_tag(ctx, "integer") == false ||
_prop_object_externalize_append_cstring(ctx, tmpstr) == false ||
diff -r 198ccb19949e -r 4b299b93cf04 common/lib/libprop/prop_string.c
--- a/common/lib/libprop/prop_string.c Wed Mar 26 18:11:26 2014 +0000
+++ b/common/lib/libprop/prop_string.c Wed Mar 26 18:12:46 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prop_string.c,v 1.11 2008/08/03 04:00:12 thorpej Exp $ */
+/* $NetBSD: prop_string.c,v 1.12 2014/03/26 18:12:46 christos Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -339,7 +339,7 @@
cp = _PROP_MALLOC(len + 1, M_PROP_STRING);
if (cp == NULL)
return (false);
- sprintf(cp, "%s%s", prop_string_contents(dst),
+ snprintf(cp, len + 1, "%s%s", prop_string_contents(dst),
prop_string_contents(src));
ocp = dst->ps_mutable;
dst->ps_mutable = cp;
@@ -373,7 +373,7 @@
cp = _PROP_MALLOC(len + 1, M_PROP_STRING);
if (cp == NULL)
return (false);
- sprintf(cp, "%s%s", prop_string_contents(dst), src);
+ snprintf(cp, len + 1, "%s%s", prop_string_contents(dst), src);
ocp = dst->ps_mutable;
dst->ps_mutable = cp;
dst->ps_size = len;
Home |
Main Index |
Thread Index |
Old Index