summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2014-04-19 17:18:58 +0000
committergilles <gilles@openbsd.org>2014-04-19 17:18:58 +0000
commit6d177801c0f72a0fcd4ff3320b42c66d94c0274a (patch)
tree21c74ecc58bf3ac9ced5e23c422b09bfbf16eb10
parentadd missing strlcpy() check when parsing "backup hostname" in smtpd.conf, (diff)
downloadwireguard-openbsd-6d177801c0f72a0fcd4ff3320b42c66d94c0274a.tar.xz
wireguard-openbsd-6d177801c0f72a0fcd4ff3320b42c66d94c0274a.zip
add missing strlcpy() check in is_if_in_group() to detect and warn about
the truncation rather than failing the ioctl() call that follows.
-rw-r--r--usr.sbin/smtpd/parse.y6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index afac7c71478..1b0cb4de010 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.140 2014/04/19 17:12:02 gilles Exp $ */
+/* $OpenBSD: parse.y,v 1.141 2014/04/19 17:18:58 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -2075,7 +2075,9 @@ is_if_in_group(const char *ifname, const char *groupname)
err(1, "socket");
memset(&ifgr, 0, sizeof(ifgr));
- strlcpy(ifgr.ifgr_name, ifname, IFNAMSIZ);
+ if (strlcpy(ifgr.ifgr_name, ifname, IFNAMSIZ) >= IFNAMSIZ)
+ errx(1, "interface name too large");
+
if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) {
if (errno == EINVAL || errno == ENOTTY)
goto end;