diff options
author | kris <kris@FreeBSD.org> | 2000-10-09 06:08:00 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2000-10-09 06:08:00 +0000 |
commit | aec252afaba2df6fe3697bd1ea4b22e73c2a1baf (patch) | |
tree | f55818063ce7ef3bc58d44211f8219b0e829e90d /usr.sbin/mrouted/cfparse.y | |
parent | fa43aea9dc832ed13b413a962469fc8df6909208 (diff) | |
download | FreeBSD-src-aec252afaba2df6fe3697bd1ea4b22e73c2a1baf.zip FreeBSD-src-aec252afaba2df6fe3697bd1ea4b22e73c2a1baf.tar.gz |
String buffer safety cleanup. I don't think any of these were exploitable
remotely, but they would be if e.g. it happened to call the logging
function using a DNS hostname.
Also replace random() by arc4random() - only one of these is arguably
required since it's directly used in the protocol, but we might as
well replace both to avoid using two different PRNGs.
Reviewed by: green, alex
Diffstat (limited to 'usr.sbin/mrouted/cfparse.y')
-rw-r--r-- | usr.sbin/mrouted/cfparse.y | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/mrouted/cfparse.y b/usr.sbin/mrouted/cfparse.y index f244d9c..2f74399 100644 --- a/usr.sbin/mrouted/cfparse.y +++ b/usr.sbin/mrouted/cfparse.y @@ -658,7 +658,7 @@ static void fatal(char *fmt, ...) { va_list ap; - char buf[200]; + char buf[MAXHOSTNAMELEN + 100]; va_start(ap, fmt); #else @@ -669,11 +669,11 @@ char *fmt; va_dcl { va_list ap; - char buf[200]; + char buf[MAXHOSTNAMELEN + 100]; va_start(ap); #endif - vsprintf(buf, fmt, ap); + vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); log(LOG_ERR,0,"%s: %s near line %d", configfilename, buf, lineno); @@ -699,7 +699,7 @@ va_dcl va_start(ap); #endif - vsprintf(buf, fmt, ap); + vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); log(LOG_WARNING,0,"%s: %s near line %d", configfilename, buf, lineno); |