summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/config/main.c6
-rw-r--r--usr.sbin/config/mkheaders.c6
-rw-r--r--usr.sbin/config/mkioconf.c7
-rw-r--r--usr.sbin/config/mkmakefile.c14
-rw-r--r--usr.sbin/config/mkswap.c9
-rw-r--r--usr.sbin/config/sem.c10
-rw-r--r--usr.sbin/config/strerror.c2
-rw-r--r--usr.sbin/usbdevs/usbdevs.c4
-rw-r--r--usr.sbin/videomode/videomode.c3
9 files changed, 34 insertions, 27 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index 8c99e5655bc..fd50958f460 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.25 2002/03/14 16:44:24 mpech Exp $ */
+/* $OpenBSD: main.c,v 1.26 2002/05/29 09:45:39 deraadt Exp $ */
/* $NetBSD: main.c,v 1.22 1997/02/02 21:12:33 thorpej Exp $ */
/*
@@ -286,7 +286,7 @@ mksymlinks()
char *p, buf[MAXPATHLEN];
const char *q;
- sprintf(buf, "arch/%s/include", machine);
+ snprintf(buf, sizeof buf, "arch/%s/include", machine);
p = sourcepath(buf);
(void)unlink("machine");
ret = symlink(p, "machine");
@@ -295,7 +295,7 @@ mksymlinks()
p, strerror(errno));
if (machinearch != NULL) {
- sprintf(buf, "arch/%s/include", machinearch);
+ snprintf(buf, sizeof buf, "arch/%s/include", machinearch);
p = sourcepath(buf);
q = machinearch;
} else {
diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c
index 376e4baac25..8d067d0f999 100644
--- a/usr.sbin/config/mkheaders.c
+++ b/usr.sbin/config/mkheaders.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkheaders.c,v 1.12 2002/03/14 16:44:24 mpech Exp $ */
+/* $OpenBSD: mkheaders.c,v 1.13 2002/05/29 09:45:39 deraadt Exp $ */
/* $NetBSD: mkheaders.c,v 1.12 1997/02/02 21:12:34 thorpej Exp $ */
/*
@@ -93,7 +93,7 @@ emitcnt(head)
char buf[BUFSIZ];
char fname[BUFSIZ];
- (void)sprintf(fname, "%s.h", head->nv_name);
+ (void)snprintf(fname, sizeof fname, "%s.h", head->nv_name);
if ((fp = fopen(fname, "r")) == NULL)
goto writeit;
nv = head;
@@ -153,7 +153,7 @@ emitopt(nv)
/*
* Compare the new file to the old.
*/
- sprintf(fname, "opt_%s.h", nv->nv_name);
+ snprintf(fname, sizeof fname, "opt_%s.h", nv->nv_name);
if ((fp = fopen(fname, "r")) == NULL)
goto writeit;
nlines = 0;
diff --git a/usr.sbin/config/mkioconf.c b/usr.sbin/config/mkioconf.c
index f9820531396..6d4192e8faa 100644
--- a/usr.sbin/config/mkioconf.c
+++ b/usr.sbin/config/mkioconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkioconf.c,v 1.19 2002/03/14 16:44:24 mpech Exp $ */
+/* $OpenBSD: mkioconf.c,v 1.20 2002/05/29 09:45:39 deraadt Exp $ */
/* $NetBSD: mkioconf.c,v 1.41 1996/11/11 14:18:49 mycroft Exp $ */
/*
@@ -127,7 +127,7 @@ emithdr(ofp)
* ioconf.c, from \"%s\"\n\
*/\n\n", conffile) < 0)
return (1);
- (void)sprintf(ifn, "ioconf.incl.%s", machine);
+ (void)snprintf(ifn, sizeof ifn, "ioconf.incl.%s", machine);
if ((ifp = fopen(ifn, "r")) != NULL) {
while ((n = fread(buf, 1, sizeof(buf), ifp)) > 0)
if (fwrite(buf, 1, n, ofp) != n)
@@ -405,7 +405,8 @@ struct cfdata cfdata[] = {\n\
vs = "";
v = 0;
if (i->i_locoff >= 0) {
- (void)sprintf(locbuf, "loc+%3d", i->i_locoff);
+ (void)snprintf(locbuf, sizeof locbuf, "loc+%3d",
+ i->i_locoff);
loc = locbuf;
} else
loc = "loc";
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 505d7d10969..9dae18ecf50 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkmakefile.c,v 1.11 2002/03/14 16:44:24 mpech Exp $ */
+/* $OpenBSD: mkmakefile.c,v 1.12 2002/05/29 09:45:39 deraadt Exp $ */
/* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */
/*
@@ -78,7 +78,8 @@ mkmakefile()
char *ifname;
char line[BUFSIZ], buf[200];
- (void)sprintf(buf, "arch/%s/conf/Makefile.%s", machine, machine);
+ (void)snprintf(buf, sizeof buf, "arch/%s/conf/Makefile.%s",
+ machine, machine);
ifname = sourcepath(buf);
if ((ifp = fopen(ifname, "r")) == NULL) {
(void)fprintf(stderr, "config: cannot read %s: %s\n",
@@ -330,12 +331,12 @@ emitfiles(fp, suffix)
if (suffix == 'c') {
for (cf = allcf; cf != NULL; cf = cf->cf_next) {
if (cf->cf_root == NULL)
- (void)sprintf(swapname,
+ (void)snprintf(swapname, sizeof swapname,
"$S/arch/%s/%s/swapgeneric.c",
machine, machine);
else
- (void)sprintf(swapname, "./swap%s.c",
- cf->cf_name);
+ (void)snprintf(swapname, sizeof swapname,
+ "./swap%s.c", cf->cf_name);
len = strlen(swapname);
if (lpos + len > 72) {
if (fputs(" \\\n", fp) < 0)
@@ -379,7 +380,8 @@ emitrules(fp)
ch = fpath[strlen(fpath) - 1];
if (islower(ch))
ch = toupper(ch);
- (void)sprintf(buf, "${%s_%c}", cp, ch);
+ (void)snprintf(buf, sizeof buf, "${%s_%c}",
+ cp, ch);
cp = buf;
}
if (fprintf(fp, "\t%s\n\n", cp) < 0)
diff --git a/usr.sbin/config/mkswap.c b/usr.sbin/config/mkswap.c
index 67de13c4ca4..11398fe6ec6 100644
--- a/usr.sbin/config/mkswap.c
+++ b/usr.sbin/config/mkswap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkswap.c,v 1.9 2002/03/14 16:44:24 mpech Exp $ */
+/* $OpenBSD: mkswap.c,v 1.10 2002/05/29 09:45:39 deraadt Exp $ */
/* $NetBSD: mkswap.c,v 1.5 1996/08/31 20:58:27 mycroft Exp $ */
/*
@@ -76,9 +76,10 @@ dev_t d;
static char buf[32];
if (d == NODEV)
- (void)sprintf(buf, "NODEV");
+ (void)snprintf(buf, sizeof buf, "NODEV");
else
- (void)sprintf(buf, "makedev(%d, %d)", major(d), minor(d));
+ (void)snprintf(buf, sizeof buf, "makedev(%d, %d)",
+ major(d), minor(d));
return buf;
}
@@ -91,7 +92,7 @@ mkoneswap(cf)
char fname[200];
char *mountroot;
- (void)sprintf(fname, "swap%s.c", cf->cf_name);
+ (void)snprintf(fname, sizeof fname, "swap%s.c", cf->cf_name);
if ((fp = fopen(fname, "w")) == NULL) {
(void)fprintf(stderr, "config: cannot write %s: %s\n",
fname, strerror(errno));
diff --git a/usr.sbin/config/sem.c b/usr.sbin/config/sem.c
index cabbb8f6caf..bf0528633d7 100644
--- a/usr.sbin/config/sem.c
+++ b/usr.sbin/config/sem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sem.c,v 1.25 2002/03/14 16:44:24 mpech Exp $ */
+/* $OpenBSD: sem.c,v 1.26 2002/05/29 09:45:39 deraadt Exp $ */
/* $NetBSD: sem.c,v 1.10 1996/11/11 23:40:11 gwr Exp $ */
/*
@@ -578,10 +578,12 @@ resolve(nvp, name, what, dflt, part)
if (dev->d_major == maj)
break;
if (dev == NULL)
- (void)sprintf(buf, "<%d/%d>", maj, min);
+ (void)snprintf(buf, sizeof buf, "<%d/%d>",
+ maj, min);
else
- (void)sprintf(buf, "%s%d%c", dev->d_name,
- min / maxpartitions, (min % maxpartitions) + 'a');
+ (void)snprintf(buf, sizeof buf, "%s%d%c",
+ dev->d_name, min / maxpartitions,
+ (min % maxpartitions) + 'a');
nv->nv_str = intern(buf);
return (0);
}
diff --git a/usr.sbin/config/strerror.c b/usr.sbin/config/strerror.c
index 2d3eb60068b..72cf0d6fbef 100644
--- a/usr.sbin/config/strerror.c
+++ b/usr.sbin/config/strerror.c
@@ -14,6 +14,6 @@ char *strerror(en)
if ((0 <= en) && (en < sys_nerr))
return sys_errlist[en];
- sprintf(errmsg, "Error %d", en);
+ snprintf(errmsg, sizeof errmsg, "Error %d", en);
return errmsg;
}
diff --git a/usr.sbin/usbdevs/usbdevs.c b/usr.sbin/usbdevs/usbdevs.c
index a22f1576e4f..ecce9a5ebfc 100644
--- a/usr.sbin/usbdevs/usbdevs.c
+++ b/usr.sbin/usbdevs/usbdevs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdevs.c,v 1.5 2002/05/10 00:09:17 nate Exp $ */
+/* $OpenBSD: usbdevs.c,v 1.6 2002/05/29 09:46:20 deraadt Exp $ */
/* $NetBSD: usbdevs.c,v 1.19 2002/02/21 00:34:31 christos Exp $ */
/*
@@ -205,7 +205,7 @@ main(int argc, char **argv)
if (dev == 0) {
for (ncont = 0, i = 0; i < 10; i++) {
- sprintf(buf, "%s%d", USBDEV, i);
+ snprintf(buf, sizeof buf, "%s%d", USBDEV, i);
f = open(buf, O_RDONLY);
if (f >= 0) {
dumpone(buf, f, addr);
diff --git a/usr.sbin/videomode/videomode.c b/usr.sbin/videomode/videomode.c
index 9dfcf165b18..797f62c78f5 100644
--- a/usr.sbin/videomode/videomode.c
+++ b/usr.sbin/videomode/videomode.c
@@ -101,7 +101,8 @@ get_grf()
errx(1, "stdin not a tty");
if (major(stb.st_rdev) != 13)
errx(1, "stdin not an ite device");
- (void)sprintf(grfname, "/dev/grf%d", minor(stb.st_rdev) & 0x7);
+ (void)snprintf(grfname, sizeof grfname, "/dev/grf%d",
+ minor(stb.st_rdev) & 0x7);
if ((grffd = open(grfname, 2)) < 0)
err(1, "%s", grfname);
return (grffd);