Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys kill sprintf
details: https://anonhg.NetBSD.org/src/rev/0ded8b896a74
branches: trunk
changeset: 327935:0ded8b896a74
user: christos <christos%NetBSD.org@localhost>
date: Fri Mar 21 16:41:15 2014 +0000
description:
kill sprintf
diffstat:
sys/arch/acorn26/stand/lib/riscosdisk.c | 6 +++---
sys/arch/acorn32/podulebus/csa.c | 6 +++---
sys/arch/acorn32/podulebus/podulebus.c | 8 ++++----
sys/arch/acorn32/stand/boot32/boot32.c | 4 ++--
sys/arch/acorn32/stand/nbfs/nbfs.c | 5 +++--
sys/netisdn/i4b_q931.c | 15 ++++++++++-----
6 files changed, 25 insertions(+), 19 deletions(-)
diffs (170 lines):
diff -r 6db55c221515 -r 0ded8b896a74 sys/arch/acorn26/stand/lib/riscosdisk.c
--- a/sys/arch/acorn26/stand/lib/riscosdisk.c Fri Mar 21 16:39:29 2014 +0000
+++ b/sys/arch/acorn26/stand/lib/riscosdisk.c Fri Mar 21 16:41:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: riscosdisk.c,v 1.1 2002/03/24 15:47:27 bjh21 Exp $ */
+/* $NetBSD: riscosdisk.c,v 1.2 2014/03/21 16:41:15 christos Exp $ */
/*-
* Copyright (c) 2001 Ben Harris
@@ -58,10 +58,10 @@
buflen = strlen(fsname) + 13;
buf = alloc(buflen);
- sprintf(buf, "%s_DescribeDisc", fsname);
+ snprintf(buf, buflen, "%s_DescribeDisc", fsname);
if (xos_swi_number_from_string(buf, &rd->describe_disc) != NULL)
return ENODEV;
- sprintf(buf, "%s_DiscOp", fsname);
+ snprintf(buf, buflen, "%s_DiscOp", fsname);
if (xos_swi_number_from_string(buf, &rd->disc_op) != NULL)
return ENODEV;
diff -r 6db55c221515 -r 0ded8b896a74 sys/arch/acorn32/podulebus/csa.c
--- a/sys/arch/acorn32/podulebus/csa.c Fri Mar 21 16:39:29 2014 +0000
+++ b/sys/arch/acorn32/podulebus/csa.c Fri Mar 21 16:41:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csa.c,v 1.11 2012/10/27 17:17:23 chs Exp $ */
+/* $NetBSD: csa.c,v 1.12 2014/03/21 16:43:00 christos Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: csa.c,v 1.11 2012/10/27 17:17:23 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: csa.c,v 1.12 2014/03/21 16:43:00 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -184,7 +184,7 @@
/* Provide an override for the host id */
ncr_sc->sc_channel.chan_id = 7;
- sprintf(hi_option, "%s.hostid", device_xname(self));
+ snprintf(hi_option, sizeof(hi_option), "%s.hostid", device_xname(self));
(void)get_bootconf_option(boot_args, hi_option,
BOOTOPT_TYPE_INT, &ncr_sc->sc_channel.chan_id);
ncr_sc->sc_adapter.adapt_minphys = minphys;
diff -r 6db55c221515 -r 0ded8b896a74 sys/arch/acorn32/podulebus/podulebus.c
--- a/sys/arch/acorn32/podulebus/podulebus.c Fri Mar 21 16:39:29 2014 +0000
+++ b/sys/arch/acorn32/podulebus/podulebus.c Fri Mar 21 16:41:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: podulebus.c,v 1.26 2011/06/03 07:35:37 matt Exp $ */
+/* $NetBSD: podulebus.c,v 1.27 2014/03/21 16:43:00 christos Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@@ -43,7 +43,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: podulebus.c,v 1.26 2011/06/03 07:35:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: podulebus.c,v 1.27 2014/03/21 16:43:00 christos Exp $");
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -461,7 +461,7 @@
for (loop = 0; loop < MAX_PODULES+MAX_NETSLOTS; ++loop) {
#if 1
/* Provide backwards compat for a while */
- sprintf(argstring, "podule%d.disable", loop);
+ snprintf(argstring, sizeof(argstring), "podule%d.disable", loop);
if (get_bootconf_option(boot_args, argstring,
BOOTOPT_TYPE_BOOLEAN, &value)) {
if (value) {
@@ -471,7 +471,7 @@
}
}
#endif
- sprintf(argstring, "podule%d=", loop);
+ snprintf(argstring, sizeof(argstring), "podule%d=", loop);
if (get_bootconf_option(boot_args, argstring,
BOOTOPT_TYPE_HEXINT, &value)) {
/* Override the ID */
diff -r 6db55c221515 -r 0ded8b896a74 sys/arch/acorn32/stand/boot32/boot32.c
--- a/sys/arch/acorn32/stand/boot32/boot32.c Fri Mar 21 16:39:29 2014 +0000
+++ b/sys/arch/acorn32/stand/boot32/boot32.c Fri Mar 21 16:41:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot32.c,v 1.40 2013/11/04 21:08:14 christos Exp $ */
+/* $NetBSD: boot32.c,v 1.41 2014/03/21 16:43:00 christos Exp $ */
/*-
* Copyright (c) 2002 Reinoud Zandijk
@@ -1058,7 +1058,7 @@
*pos++ = base;
*pos++ = (char) 0;
- sprintf(scrap, format, value);
+ snprintf(scrap, sizeof(scrap), format, value);
length = strlen(scrap);
return scrap+length-width;
diff -r 6db55c221515 -r 0ded8b896a74 sys/arch/acorn32/stand/nbfs/nbfs.c
--- a/sys/arch/acorn32/stand/nbfs/nbfs.c Fri Mar 21 16:39:29 2014 +0000
+++ b/sys/arch/acorn32/stand/nbfs/nbfs.c Fri Mar 21 16:41:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nbfs.c,v 1.10 2013/06/10 02:21:10 mrg Exp $ */
+/* $NetBSD: nbfs.c,v 1.11 2014/03/21 16:43:00 christos Exp $ */
/*-
* Copyright (c) 2006 Ben Harris
@@ -449,7 +449,8 @@
case 16: /* Shut down */
return NULL;
default:
- sprintf(error.errmess, "nbfs_func %d not implemented", reason);
+ snprintf(error.errmess, sizeof(error.errmess),
+ "nbfs_func %d not implemented", reason);
return &error;
}
}
diff -r 6db55c221515 -r 0ded8b896a74 sys/netisdn/i4b_q931.c
--- a/sys/netisdn/i4b_q931.c Fri Mar 21 16:39:29 2014 +0000
+++ b/sys/netisdn/i4b_q931.c Fri Mar 21 16:41:15 2014 +0000
@@ -27,7 +27,7 @@
* i4b_q931.c - Q931 received messages handling
* --------------------------------------------
*
- * $Id: i4b_q931.c,v 1.21 2006/11/16 01:33:49 christos Exp $
+ * $Id: i4b_q931.c,v 1.22 2014/03/21 16:45:49 christos Exp $
*
* $FreeBSD$
*
@@ -36,7 +36,7 @@
*---------------------------------------------------------------------------*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i4b_q931.c,v 1.21 2006/11/16 01:33:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i4b_q931.c,v 1.22 2014/03/21 16:45:49 christos Exp $");
#ifdef __FreeBSD__
#include "i4bq931.h"
@@ -272,6 +272,7 @@
i4b_decode_q931_cs0_ie(call_desc_t *cd, int msg_len, u_char *msg_ptr)
{
int i, j;
+ size_t len;
char *p;
switch(*msg_ptr)
@@ -415,11 +416,15 @@
case IEI_DATETIME: /* date/time */
i = 2;
j = msg_ptr[1];
- p = &(cd->datetime[0]);
+ p = cd->datetime;
*p = '\0';
- for(j = msg_ptr[1]; j > 0; j--, i++)
- sprintf(p+strlen(p), "%02d", msg_ptr[i]);
+ len = 0;
+ for(j = msg_ptr[1]; j > 0; j--, i++) {
+ snprintf(p + len, sizeof(cd->datetime) - len,
+ "%02d", msg_ptr[i]);
+ len = strlen(p);
+ }
NDBGL3(L3_P_MSG, "IEI_DATETIME = %s", cd->datetime);
break;
Home |
Main Index |
Thread Index |
Old Index