diff options
author | Warner Losh <imp@FreeBSD.org> | 1997-12-24 18:56:03 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 1997-12-24 18:56:03 +0000 |
commit | 9bc34f7ce14c4401e6ee449f9eeb2c9222fbe756 (patch) | |
tree | 387678feec78fd449ac77e874c0ce12402366d81 /libexec/bootpd | |
parent | b44e4b7a2b2e4abdebb44e9c33b06a6d967ef9d7 (diff) | |
download | src-9bc34f7ce14c4401e6ee449f9eeb2c9222fbe756.tar.gz src-9bc34f7ce14c4401e6ee449f9eeb2c9222fbe756.zip |
Use snprintf rather than printf out of paranoia
Obtained from: OpenBSD
Notes
Notes:
svn path=/head/; revision=31971
Diffstat (limited to 'libexec/bootpd')
-rw-r--r-- | libexec/bootpd/getether.c | 4 | ||||
-rw-r--r-- | libexec/bootpd/hwaddr.c | 4 | ||||
-rw-r--r-- | libexec/bootpd/readfile.c | 5 | ||||
-rw-r--r-- | libexec/bootpd/report.c | 2 | ||||
-rw-r--r-- | libexec/bootpd/tools/bootptest/bootptest.c | 4 |
5 files changed, 10 insertions, 9 deletions
diff --git a/libexec/bootpd/getether.c b/libexec/bootpd/getether.c index cf01b03fe4d0..8f31bcbbe09f 100644 --- a/libexec/bootpd/getether.c +++ b/libexec/bootpd/getether.c @@ -7,7 +7,7 @@ * If you figure out how to do this on another system, * please let me know. <gwr@mc.com> * - * $Id$ + * $Id: getether.c,v 1.7 1997/02/22 14:21:05 peter Exp $ */ #include <sys/types.h> @@ -195,7 +195,7 @@ getether(ifname, eap) char *enaddr; int unit = -1; /* which unit to attach */ - sprintf(devname, "/dev/%s", ifname); + snprintf(devname, sizeof(devname), "/dev/%s", ifname); fd = open(devname, 2); if (fd < 0) { /* Try without the trailing digit. */ diff --git a/libexec/bootpd/hwaddr.c b/libexec/bootpd/hwaddr.c index bc41cff2d7e6..b4fe5e4c393e 100644 --- a/libexec/bootpd/hwaddr.c +++ b/libexec/bootpd/hwaddr.c @@ -2,7 +2,7 @@ * hwaddr.c - routines that deal with hardware addresses. * (i.e. Ethernet) * - * $Id$ + * $Id: hwaddr.c,v 1.5 1997/02/22 14:21:07 peter Exp $ */ #include <sys/types.h> @@ -198,7 +198,7 @@ setarp(s, ia, hafamily, haddr, halen) extern char *inet_ntoa(); a = inet_ntoa(*ia); - sprintf(buf, "arp -d %s; arp -s %s %s temp", + snprintf(buf, sizeof(buf), "arp -d %s; arp -s %s %s temp", a, a, haddrtoa(haddr, halen)); if (debug > 2) report(LOG_INFO, buf); diff --git a/libexec/bootpd/readfile.c b/libexec/bootpd/readfile.c index 8dfd43023d0b..8d895fd0e906 100644 --- a/libexec/bootpd/readfile.c +++ b/libexec/bootpd/readfile.c @@ -19,7 +19,7 @@ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - $Id$ + $Id: readfile.c,v 1.4 1997/02/22 14:21:09 peter Exp $ ************************************************************************/ @@ -817,7 +817,8 @@ eval_symbol(symbol, hp) if ((*symbol)[0] == 'T') { /* generic symbol */ (*symbol)++; value = get_u_long(symbol); - sprintf(current_tagname, "T%d", (int)value); + snprintf(current_tagname, sizeof(current_tagname), + "T%d", (int)value); eat_whitespace(symbol); if ((*symbol)[0] != '=') { return E_SYNTAX_ERROR; diff --git a/libexec/bootpd/report.c b/libexec/bootpd/report.c index 4f7f03616a2a..e754a3013c2e 100644 --- a/libexec/bootpd/report.c +++ b/libexec/bootpd/report.c @@ -111,7 +111,7 @@ report(priority, fmt, va_alist) #else va_start(ap); #endif - vsprintf(buf, fmt, ap); + vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); /* diff --git a/libexec/bootpd/tools/bootptest/bootptest.c b/libexec/bootpd/tools/bootptest/bootptest.c index 2e2311284fc2..92a38372ffc5 100644 --- a/libexec/bootpd/tools/bootptest/bootptest.c +++ b/libexec/bootpd/tools/bootptest/bootptest.c @@ -31,7 +31,7 @@ * 09/28/93 Released version 1.0 * 09/93 Original developed by Gordon W. Ross <gwr@mc.com> * - * $Id$ + * $Id: bootptest.c,v 1.4 1997/02/22 14:21:20 peter Exp $ */ char *usage = "bootptest [-h] server-name [vendor-data-template-file]"; @@ -503,7 +503,7 @@ ipaddr_string(ina) u_char *p; p = (u_char *) ina; - sprintf(b, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); + snprintf(b, sizeof(b), "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); return (b); } |