summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-05-14 21:16:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-05-14 21:16:52 +0000
commit16702423142900702c4d825f9b806f9b19b77356 (patch)
tree7a91923989538dfd755191d8f6a88a4797530230
parentdc315e71ee8035dff83bf123daa23e0faf00f467 (diff)
more careful scanf
-rw-r--r--gnu/usr.bin/cvs/src/rcs.c2
-rw-r--r--gnu/usr.bin/cvs/src/update.c4
-rw-r--r--usr.sbin/arp/arp.c4
-rw-r--r--usr.sbin/config/mkheaders.c4
-rw-r--r--usr.sbin/ctm/ctm_rmail/ctm_rmail.c4
-rw-r--r--usr.sbin/httpd/support/httpd_monitor.c2
-rw-r--r--usr.sbin/tcpdump/print-atalk.c6
7 files changed, 13 insertions, 13 deletions
diff --git a/gnu/usr.bin/cvs/src/rcs.c b/gnu/usr.bin/cvs/src/rcs.c
index 29461b69d3f..c74e5ea7e24 100644
--- a/gnu/usr.bin/cvs/src/rcs.c
+++ b/gnu/usr.bin/cvs/src/rcs.c
@@ -3831,7 +3831,7 @@ RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat)
if (info != NULL)
{
/* If the size of `devtype' changes, fix the sscanf call also */
- char devtype[16];
+ char devtype[16+1];
if (sscanf (info->data, "%16s %lu",
devtype, &devnum_long) < 2)
diff --git a/gnu/usr.bin/cvs/src/update.c b/gnu/usr.bin/cvs/src/update.c
index 31ee6ca2c75..7933dd23c86 100644
--- a/gnu/usr.bin/cvs/src/update.c
+++ b/gnu/usr.bin/cvs/src/update.c
@@ -2580,7 +2580,7 @@ special_file_mismatch (finfo, rev1, rev2)
else
{
/* If the size of `ftype' changes, fix the sscanf call also */
- char ftype[16];
+ char ftype[16+1];
if (sscanf (n->data, "%16s %lu", ftype,
&dev_long) < 2)
error (1, 0, "%s:%s has bad `special' newphrase %s",
@@ -2655,7 +2655,7 @@ special_file_mismatch (finfo, rev1, rev2)
else
{
/* If the size of `ftype' changes, fix the sscanf call also */
- char ftype[16];
+ char ftype[16+1];
if (sscanf (n->data, "%16s %lu", ftype,
&dev_long) < 2)
error (1, 0, "%s:%s has bad `special' newphrase %s",
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index 527f6b7b52a..70d9306151d 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arp.c,v 1.11 1998/05/11 01:34:50 deraadt Exp $ */
+/* $OpenBSD: arp.c,v 1.12 1998/05/14 21:16:42 deraadt Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
@@ -155,7 +155,7 @@ file(name)
args[4] = &arg[4][0];
retval = 0;
while (fgets(line, 100, fp) != NULL) {
- i = sscanf(line, "%50s %50s %50s %50s %50s", arg[0], arg[1], arg[2],
+ i = sscanf(line, "%49s %49s %49s %49s %49s", arg[0], arg[1], arg[2],
arg[3], arg[4]);
if (i < 2) {
warnx("bad line: %s", line);
diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c
index 92870708cde..dc4ed3f9f38 100644
--- a/usr.sbin/config/mkheaders.c
+++ b/usr.sbin/config/mkheaders.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkheaders.c,v 1.9 1998/05/11 01:19:17 deraadt Exp $ */
+/* $OpenBSD: mkheaders.c,v 1.10 1998/05/14 21:16:44 deraadt Exp $ */
/* $NetBSD: mkheaders.c,v 1.12 1997/02/02 21:12:34 thorpej Exp $ */
/*
@@ -100,7 +100,7 @@ emitcnt(head)
while (fgets(buf, sizeof(buf), fp) != NULL) {
if (nv == NULL)
goto writeit;
- if (sscanf(buf, "#define %100s %d", nam, &cnt) != 2 ||
+ if (sscanf(buf, "#define %99s %d", nam, &cnt) != 2 ||
strcmp(nam, cntname(nv->nv_name)) != 0 ||
cnt != nv->nv_int)
goto writeit;
diff --git a/usr.sbin/ctm/ctm_rmail/ctm_rmail.c b/usr.sbin/ctm/ctm_rmail/ctm_rmail.c
index 3a3628e2d07..06897e35510 100644
--- a/usr.sbin/ctm/ctm_rmail/ctm_rmail.c
+++ b/usr.sbin/ctm/ctm_rmail/ctm_rmail.c
@@ -164,7 +164,7 @@ apply_complete()
return;
}
- i = fscanf(fp, "%20s %d %c", class, &dn, junk);
+ i = fscanf(fp, "%19s %d %c", class, &dn, junk);
fclose(fp);
if (i != 2)
{
@@ -294,7 +294,7 @@ read_piece(char *input_file)
char *s;
int fd = -1;
- if (sscanf(line, "CTM_MAIL BEGIN %30s %d %d %c",
+ if (sscanf(line, "CTM_MAIL BEGIN %29s %d %d %c",
delta, &pce, &npieces, junk) != 3)
continue;
diff --git a/usr.sbin/httpd/support/httpd_monitor.c b/usr.sbin/httpd/support/httpd_monitor.c
index b50be4aad03..f580a464824 100644
--- a/usr.sbin/httpd/support/httpd_monitor.c
+++ b/usr.sbin/httpd/support/httpd_monitor.c
@@ -259,7 +259,7 @@ FILE *thefile;
while (!(feof(thefile))) {
fgets(line, ASIZE-1, thefile);
*value = '\0'; /* protect braindead sscanf() */
- sscanf(line, "%1024s %1024s", param, value);
+ sscanf(line, "%1023s %1023s", param, value);
if (strcmp(param, "PidFile")==0 && *value)
strcpy(pidfile, value);
if (strcmp(param, "ScoreBoardFile")==0 && *value)
diff --git a/usr.sbin/tcpdump/print-atalk.c b/usr.sbin/tcpdump/print-atalk.c
index c67f14388d9..c6626571fbb 100644
--- a/usr.sbin/tcpdump/print-atalk.c
+++ b/usr.sbin/tcpdump/print-atalk.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-atalk.c,v 1.7 1997/07/25 20:12:21 mickey Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-atalk.c,v 1.8 1998/05/14 21:16:51 deraadt Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -556,11 +556,11 @@ ataddr_string(u_short atnet, u_char athost)
while (fgets(line, sizeof(line), fp)) {
if (line[0] == '\n' || line[0] == 0 || line[0] == '#')
continue;
- if (sscanf(line, "%d.%d.%d %s", &i1, &i2, &i3,
+ if (sscanf(line, "%d.%d.%d %255s", &i1, &i2, &i3,
nambuf) == 4)
/* got a hostname. */
i3 |= ((i1 << 8) | i2) << 8;
- else if (sscanf(line, "%d.%d %s", &i1, &i2,
+ else if (sscanf(line, "%d.%d %255s", &i1, &i2,
nambuf) == 3)
/* got a net name */
i3 = (((i1 << 8) | i2) << 8) | 255;