Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm32 Use snprintf() instead of sprintf().



details:   https://anonhg.NetBSD.org/src/rev/f708b96e2fb9
branches:  trunk
changeset: 782986:f708b96e2fb9
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Nov 30 08:15:45 2012 +0000

description:
Use snprintf() instead of sprintf().

diffstat:

 sys/arch/arm/arm32/cpu.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 81552f6076ce -r f708b96e2fb9 sys/arch/arm/arm32/cpu.c
--- a/sys/arch/arm/arm32/cpu.c  Fri Nov 30 08:12:27 2012 +0000
+++ b/sys/arch/arm/arm32/cpu.c  Fri Nov 30 08:15:45 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.89 2012/11/30 08:12:27 msaitoh Exp $ */
+/*     $NetBSD: cpu.c,v 1.90 2012/11/30 08:15:45 msaitoh Exp $ */
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.89 2012/11/30 08:12:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.90 2012/11/30 08:15:45 msaitoh Exp $");
 
 #include <sys/systm.h>
 #include <sys/conf.h>
@@ -613,8 +613,8 @@
                        cpu_class = cpuids[i].cpu_class;
                        steppingstr = cpuids[i].cpu_steppings[cpuid &
                            CPU_ID_REVISION_MASK];
-                       sprintf(cpu_model, "%s%s%s (%s core)",
-                           cpuids[i].cpu_classname,
+                       snprintf(cpu_model, sizeof(cpu_model),
+                           "%s%s%s (%s core)", cpuids[i].cpu_classname,
                            steppingstr[0] == '*' ? "" : " ",
                            &steppingstr[steppingstr[0] == '*'],
                            cpu_classes[cpu_class].class_name);
@@ -622,7 +622,8 @@
                }
 
        if (cpuids[i].cpuid == 0)
-               sprintf(cpu_model, "unknown CPU (ID = 0x%x)", cpuid);
+               snprintf(cpu_model, sizeof(cpu_model),
+                   "unknown CPU (ID = 0x%x)", cpuid);
 
        if (ci->ci_data.cpu_cc_freq != 0) {
                char freqbuf[8];



Home | Main Index | Thread Index | Old Index