Browse Source

do not copy up to two garbage characters from a 1 char string into a 4 char

output buffer; ok henning
OPENBSD_4_4
deraadt 16 years ago
parent
commit
a18f78208a
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      src/usr.sbin/ntpd/sensors.c

+ 5
- 3
src/usr.sbin/ntpd/sensors.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: sensors.c,v 1.37 2008/06/09 16:52:04 deraadt Exp $ */
/* $OpenBSD: sensors.c,v 1.38 2008/06/09 18:30:03 deraadt Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@ -129,8 +129,10 @@ sensor_add(int sensordev, char *dxname)
if (cs->refstr == NULL)
memcpy(&s->refstr, "HARD", sizeof(s->refstr));
else
memcpy(&s->refstr, cs->refstr, sizeof(s->refstr));
else {
s->refstr = 0;
strncpy((char *)&s->refstr, cs->refstr, sizeof(s->refstr));
}
TAILQ_INSERT_TAIL(&conf->ntp_sensors, s, entry);


Loading…
Cancel
Save