summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd/syslogd.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2015-02-24 01:29:49 +0000
committerbluhm <bluhm@openbsd.org>2015-02-24 01:29:49 +0000
commit0b97411a71f3a5f5761790609a7acd7d452eea7d (patch)
treedce1905bd0793cf5ae24d990bae47698575fa840 /usr.sbin/syslogd/syslogd.c
parentfurther silence spurious error message even when -v is specified (diff)
downloadwireguard-openbsd-0b97411a71f3a5f5761790609a7acd7d452eea7d.tar.xz
wireguard-openbsd-0b97411a71f3a5f5761790609a7acd7d452eea7d.zip
Explain in a comment that atoi() is safe here.
OK deraadt@
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r--usr.sbin/syslogd/syslogd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 5c7fbcd08bd..7ac5701c7fc 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.159 2015/02/22 15:09:54 jsing Exp $ */
+/* $OpenBSD: syslogd.c,v 1.160 2015/02/24 01:29:49 bluhm Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -842,6 +842,7 @@ tcp_errorcb(struct bufferevent *bufev, short event, void *arg)
if (!isdigit(*p))
break;
}
+ /* Using atoi() is safe as buf starts with 1 to 4 digits and a space. */
if (buf < end && !(buf + 1 <= p && p < end && *p == ' ' &&
(l = atoi(buf)) > 0 && buf + l < end && buf[l] == '\n')) {
for (p = buf; p < end; p++) {