Use the destination buffer size when copying strings.

(Didn't matter in practice, because the destination was large enough.)
This commit is contained in:
jdc 2015-12-07 20:59:44 +00:00
parent da8d5d2ae7
commit a987263c2d
1 changed files with 6 additions and 4 deletions

View File

@ -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 @@ admtemp_attach(device_t parent, device_t self, void *aux)
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])) {