Module Name:    src
Committed By:   christos
Date:           Wed Mar 26 17:35:08 UTC 2014

Modified Files:
        src/sys/arch/sandpoint/pci: pci_machdep.c
        src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
fix sprintf.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sandpoint/pci/pci_machdep.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sandpoint/stand/altboot/main.c

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

Modified files:

Index: src/sys/arch/sandpoint/pci/pci_machdep.c
diff -u src/sys/arch/sandpoint/pci/pci_machdep.c:1.31 src/sys/arch/sandpoint/pci/pci_machdep.c:1.32
--- src/sys/arch/sandpoint/pci/pci_machdep.c:1.31	Wed Dec 28 15:33:20 2011
+++ src/sys/arch/sandpoint/pci/pci_machdep.c	Wed Mar 26 13:35:08 2014
@@ -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 @@ pci_intr_string(pci_chipset_tag_t pc, pc
 	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;
 	
 }

Index: src/sys/arch/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.24 src/sys/arch/sandpoint/stand/altboot/main.c:1.25
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.24	Sat Mar 22 14:54:28 2014
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Wed Mar 26 13:35:08 2014
@@ -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 @@ main(int argc, char *argv[], char *boota
 	 * 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) {

Reply via email to