diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-31 12:56:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-31 12:56:09 +0000 |
commit | 5107a4b7e22f40b117536853264ff985555e9a02 (patch) | |
tree | d76c6873ebe74863e4f4b578e79a06c3211c288e /usr.sbin/eeprom | |
parent | 6a142e81fcb2c69c6777c6d44292508865f22bfa (diff) |
buf oflow in some more "NetBSD Foundation" code
Diffstat (limited to 'usr.sbin/eeprom')
-rw-r--r-- | usr.sbin/eeprom/eehandlers.c | 18 | ||||
-rw-r--r-- | usr.sbin/eeprom/ophandlers.c | 7 |
2 files changed, 13 insertions, 12 deletions
diff --git a/usr.sbin/eeprom/eehandlers.c b/usr.sbin/eeprom/eehandlers.c index 559c8b44e88..6a192c1e407 100644 --- a/usr.sbin/eeprom/eehandlers.c +++ b/usr.sbin/eeprom/eehandlers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eehandlers.c,v 1.4 1996/08/31 12:42:49 deraadt Exp $ */ +/* $OpenBSD: eehandlers.c,v 1.5 1996/08/31 12:56:06 deraadt Exp $ */ /* $NetBSD: eehandlers.c,v 1.2 1996/02/28 01:13:22 thorpej Exp $ */ /*- @@ -504,22 +504,22 @@ doio(ktent, buf, len, wr) fd = open(path_eeprom, wr == IO_WRITE ? O_RDWR : O_RDONLY, 0640); if (fd < 0) { - sprintf(err_str, "open: %s: %s", path_eeprom, + snprintf(err_str, sizeof err_str, "open: %s: %s", path_eeprom, strerror(errno)); free(buf2); return (1); } if (lseek(fd, (off_t)ktent->kt_offset, SEEK_SET) < (off_t)0) { - sprintf(err_str, "lseek: %s:", path_eeprom, + snprintf(err_str, sizeof err_str, "lseek: %s: %s", path_eeprom, strerror(errno)); rval = 1; goto done; } if (read(fd, buf2, len) != len) { - sprintf(err_str, "read: %s: %s", path_eeprom, - strerror(errno)); + snprintf(err_str, sizeof err_str, "read: %s: %s", path_eeprom, + strerror(errno)); return (1); } @@ -528,16 +528,16 @@ doio(ktent, buf, len, wr) goto done; if (lseek(fd, (off_t)ktent->kt_offset, SEEK_SET) < (off_t)0) { - sprintf(err_str, "lseek: %s: %s", path_eeprom, - strerror(errno)); + snprintf(err_str, sizeof err_str, "lseek: %s: %s", + path_eeprom, strerror(errno)); rval = 1; goto done; } ++update_checksums; if (write(fd, buf, len) < 0) { - sprintf(err_str, "write: %s: %s", path_eeprom, - strerror(errno)); + snprintf(err_str, sizeof err_str, "write: %s: %s", + path_eeprom, strerror(errno)); rval = 1; goto done; } diff --git a/usr.sbin/eeprom/ophandlers.c b/usr.sbin/eeprom/ophandlers.c index 209f1353144..8aad8c34ae2 100644 --- a/usr.sbin/eeprom/ophandlers.c +++ b/usr.sbin/eeprom/ophandlers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ophandlers.c,v 1.2 1996/03/25 15:55:22 niklas Exp $ */ +/* $OpenBSD: ophandlers.c,v 1.3 1996/08/31 12:56:08 deraadt Exp $ */ /* $NetBSD: ophandlers.c,v 1.2 1996/02/28 01:13:30 thorpej Exp $ */ /*- @@ -71,7 +71,7 @@ static struct extabent opextab[] = { }; #define BARF(str1, str2) { \ - sprintf(err_str, "%s: %s", (str1), (str2)); \ + snprintf(err_str, sizeof err_str "%s: %s", (str1), (str2)); \ ++eval; \ return (err_str); \ }; @@ -146,7 +146,8 @@ op_handler(keyword, arg) BARF("OPIOCGET", strerror(errno)); if (opio.op_buflen <= 0) { - sprintf(err_str, "nothing available for %s", + snprintf(err_str, sizeof err_str, + "nothing available for %s", keyword); return (err_str); } |