Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sandpoint fix sprintf.
details: https://anonhg.NetBSD.org/src/rev/bc97890e02f7
branches: trunk
changeset: 328110:bc97890e02f7
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 26 17:35:08 2014 +0000
description:
fix sprintf.
diffstat:
sys/arch/sandpoint/pci/pci_machdep.c | 6 +++---
sys/arch/sandpoint/stand/altboot/main.c | 9 +++++----
2 files changed, 8 insertions(+), 7 deletions(-)
diffs (57 lines):
diff -r 3c3a231089fd -r bc97890e02f7 sys/arch/sandpoint/pci/pci_machdep.c
--- a/sys/arch/sandpoint/pci/pci_machdep.c Wed Mar 26 17:31:13 2014 +0000
+++ b/sys/arch/sandpoint/pci/pci_machdep.c Wed Mar 26 17:35:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.31 2011/12/28 20:33:20 phx Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.32 2014/03/26 17:35:08 christos Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.31 2011/12/28 20:33:20 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.32 2014/03/26 17:35:08 christos Exp $");
#include "opt_pci.h"
@@ -393,7 +393,7 @@
if (ih < 0 || ih >= OPENPIC_ICU)
panic("pci_intr_string: bogus handle 0x%x", ih);
- sprintf(irqstr, "irq %d", ih + I8259_ICU);
+ snprintf(irqstr, sizeof(irqstr), "irq %d", ih + I8259_ICU);
return irqstr;
}
diff -r 3c3a231089fd -r bc97890e02f7 sys/arch/sandpoint/stand/altboot/main.c
--- a/sys/arch/sandpoint/stand/altboot/main.c Wed Mar 26 17:31:13 2014 +0000
+++ b/sys/arch/sandpoint/stand/altboot/main.c Wed Mar 26 17:35:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.24 2014/03/22 18:54:28 jakllsch Exp $ */
+/* $NetBSD: main.c,v 1.25 2014/03/26 17:35:08 christos Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -287,16 +287,17 @@
* which have valid disklabels.
*/
if (n >= argc) {
+ static const size_t blen = sizeof("wdN:");
n = 0;
argc = 0;
- argv = alloc(MAX_UNITS * (sizeof(char *) + sizeof("wdN:")));
+ argv = alloc(MAX_UNITS * (sizeof(char *) + blen));
bname = (char *)(argv + MAX_UNITS);
for (i = 0; i < MAX_UNITS; i++) {
if (!dlabel_valid(i))
continue;
- sprintf(bname, "wd%d:", i);
+ snprintf(bname, blen, "wd%d:", i);
argv[argc++] = bname;
- bname += sizeof("wdN:");
+ bname += blen;
}
/* use default drive if no valid disklabel is found */
if (argc == 0) {
Home |
Main Index |
Thread Index |
Old Index