Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c Use the destination buffer size when copying str...



details:   https://anonhg.NetBSD.org/src/rev/38378e28eace
branches:  trunk
changeset: 342129:38378e28eace
user:      jdc <jdc%NetBSD.org@localhost>
date:      Mon Dec 07 20:59:44 2015 +0000

description:
Use the destination buffer size when copying strings.
(Didn't matter in practice, because the destination was large enough.)

diffstat:

 sys/dev/i2c/adm1021.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 8ef1201010d7 -r 38378e28eace sys/dev/i2c/adm1021.c
--- a/sys/dev/i2c/adm1021.c     Mon Dec 07 20:57:39 2015 +0000
+++ b/sys/dev/i2c/adm1021.c     Mon Dec 07 20:59:44 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adm1021.c,v 1.9 2015/09/27 13:02:21 phx Exp $ */
+/*     $NetBSD: adm1021.c,v 1.10 2015/12/07 20:59:44 jdc Exp $ */
 /*     $OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $        */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.9 2015/09/27 13:02:21 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.10 2015/12/07 20:59:44 jdc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -163,8 +163,10 @@
        sc->sc_sensor[ADMTEMP_EXT].units = ENVSYS_STEMP;
        sc->sc_sensor[ADMTEMP_INT].state = ENVSYS_SINVALID;
        sc->sc_sensor[ADMTEMP_EXT].state = ENVSYS_SINVALID;
-       strlcpy(sc->sc_sensor[ADMTEMP_INT].desc, "internal",sizeof("internal"));
-       strlcpy(sc->sc_sensor[ADMTEMP_EXT].desc, "external",sizeof("external"));
+       strlcpy(sc->sc_sensor[ADMTEMP_INT].desc, "internal",
+           sizeof(sc->sc_sensor[ADMTEMP_INT].desc));
+       strlcpy(sc->sc_sensor[ADMTEMP_EXT].desc, "external",
+           sizeof(sc->sc_sensor[ADMTEMP_EXT].desc));
        sc->sc_sme = sysmon_envsys_create();
        if (sysmon_envsys_sensor_attach(
            sc->sc_sme, &sc->sc_sensor[ADMTEMP_INT])) {



Home | Main Index | Thread Index | Old Index