openbsd-ports/sysutils/nut/patches/patch-drivers_microdowell_c

31 lines
1.4 KiB
Plaintext
Raw Normal View History

$OpenBSD: patch-drivers_microdowell_c,v 1.1 2004/02/09 06:48:48 marcm Exp $
--- drivers/microdowell.c.orig 2004-01-03 10:37:16.000000000 -0800
+++ drivers/microdowell.c 2004-01-03 10:38:17.000000000 -0800
@@ -79,7 +79,7 @@ static int ups_model_ok (char *buf, unsi
dstate_setinfo("ups.model", "BBox Pro USB");
upslogx(LOG_NOTICE, "BBox Pro USB rev. %d on %s.\n", upsRelease, device_path);
}
- sprintf (upsSerial, "SH%c.%c", buf[4], buf[6]);
+ snprintf (upsSerial, sizeof (upsSerial), "SH%c.%c", buf[4], buf[6]);
dstate_setinfo("ups.serial", "%s", upsSerial);
return (100 + upsRelease);
}
@@ -95,7 +95,7 @@ static int ups_model_ok (char *buf, unsi
"BBox Interactive USB");
upslogx(LOG_NOTICE, "BBox Interactive USB rev. %d on %s.\n", upsRelease, device_path);
}
- sprintf (upsSerial, "MD%c.%c", buf[4], buf[6]);
+ snprintf (upsSerial, sizeof (upsSerial), "MD%c.%c", buf[4], buf[6]);
dstate_setinfo("ups.serial", "%s", upsSerial);
return (upsRelease);
}
@@ -104,7 +104,7 @@ static int ups_model_ok (char *buf, unsi
upsRelease = (buf[4] - '0') * 10 + buf[6] - '0';
dstate_setinfo("ups.model", "HiBox USB");
upslogx(LOG_NOTICE, "HiBox USB rev. %d on %s.\n", upsRelease, device_path);
- sprintf (upsSerial, "B5%c.%c", buf[4], buf[6]);
+ snprintf (upsSerial, sizeof (upsSerial), "B5%c.%c", buf[4], buf[6]);
dstate_setinfo("ups.serial", "%s", upsSerial);
return (upsRelease);
}