summaryrefslogtreecommitdiff
path: root/usr.sbin/mrouted
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-12 22:55:02 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-12 22:55:02 +0000
commita2fbae0e00ccc530ac73a7329de5f999067c734a (patch)
treecf02b99090be89259c0c5715124ab6f206bcf497 /usr.sbin/mrouted
parent78595d074d3702326e01061c3d4e267e806dea22 (diff)
less sprintf
Diffstat (limited to 'usr.sbin/mrouted')
-rw-r--r--usr.sbin/mrouted/main.c6
-rw-r--r--usr.sbin/mrouted/snmp.c5
2 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c
index da0f9f3d434..22dbe769643 100644
--- a/usr.sbin/mrouted/main.c
+++ b/usr.sbin/mrouted/main.c
@@ -30,7 +30,7 @@
#ifndef lint
static char rcsid[] =
- "@(#) $Id: main.c,v 1.12 2003/03/03 15:14:28 deraadt Exp $";
+ "@(#) $Id: main.c,v 1.13 2003/03/12 22:55:01 deraadt Exp $";
#endif
extern char *configfilename;
@@ -179,7 +179,7 @@ usage: fprintf(stderr,
#else
(void)openlog("mrouted", LOG_PID);
#endif
- sprintf(versionstring, "mrouted version %d.%d",
+ snprintf(versionstring, sizeof versionstring, "mrouted version %d.%d",
PROTOCOL_VERSION, MROUTED_VERSION);
log(LOG_NOTICE, 0, "%s", versionstring);
@@ -634,7 +634,7 @@ log(int severity, int syserr, char *format, ...)
time_t t;
va_start(ap, format);
- vsprintf(&fmt[10], format, ap);
+ vsnprintf(&fmt[10], sizeof fmt - 10, format, ap);
va_end(ap);
msg = (severity == LOG_WARNING) ? fmt : &fmt[10];
diff --git a/usr.sbin/mrouted/snmp.c b/usr.sbin/mrouted/snmp.c
index 9bc9bc61b05..f3b5a265540 100644
--- a/usr.sbin/mrouted/snmp.c
+++ b/usr.sbin/mrouted/snmp.c
@@ -216,7 +216,8 @@ o_scalar(vp, name, length, exact, var_len, write_method)
case dvmrpVersion: {
static char buff[15];
- sprintf(buff, "mrouted%d.%d", PROTOCOL_VERSION, MROUTED_VERSION);
+ snprintf(buff, sizeof buff, "mrouted%d.%d",
+ PROTOCOL_VERSION, MROUTED_VERSION);
*var_len = strlen(buff);
return (u_char *)buff;
}
@@ -498,7 +499,7 @@ o_dvmrpNeighborTable(vp, name, length, exact, var_len, write_method)
case dvmrpNeighborVersion: {
static char buff[15];
- sprintf(buff, "%d.%d", neighbor->al_pv, neighbor->al_mv);
+ snprintf(buff, sizeof buff, "%d.%d", neighbor->al_pv, neighbor->al_mv);
*var_len = strlen(buff);
return (u_char *)buff;
}