diff options
author | 2014-04-20 16:07:10 +0000 | |
---|---|---|
committer | 2014-04-20 16:07:10 +0000 | |
commit | 29430719896ea7aa3e7efb38e123180b7982b025 (patch) | |
tree | c70fc72eadcc3c99baf5fb0c8311e9e342b9fd4d | |
parent | Only issue a single dhcp requests per interface with the host-name (diff) | |
download | wireguard-openbsd-29430719896ea7aa3e7efb38e123180b7982b025.tar.xz wireguard-openbsd-29430719896ea7aa3e7efb38e123180b7982b025.zip |
Just to be pedantic, fail if strlcpy managed to overflow the socket path.
-rw-r--r-- | usr.sbin/relayd/agentx.c | 6 | ||||
-rw-r--r-- | usr.sbin/snmpd/agentx.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/relayd/agentx.c b/usr.sbin/relayd/agentx.c index e11cc612329..645ab66c1f4 100644 --- a/usr.sbin/relayd/agentx.c +++ b/usr.sbin/relayd/agentx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agentx.c,v 1.4 2014/04/20 10:46:20 reyk Exp $ */ +/* $OpenBSD: agentx.c,v 1.5 2014/04/20 16:07:10 reyk Exp $ */ /* * Copyright (c) 2013,2014 Bret Stephen Lambert <blambert@openbsd.org> * @@ -91,7 +91,9 @@ snmp_agentx_open(const char *path, char *descr, struct snmp_oid *oid) bzero(&sun, sizeof(sun)); sun.sun_family = AF_UNIX; - strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >= + sizeof(sun.sun_path)) + goto fail; if (connect(s, (struct sockaddr *)&sun, sizeof(sun)) == -1) goto fail; diff --git a/usr.sbin/snmpd/agentx.c b/usr.sbin/snmpd/agentx.c index e11cc612329..645ab66c1f4 100644 --- a/usr.sbin/snmpd/agentx.c +++ b/usr.sbin/snmpd/agentx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agentx.c,v 1.4 2014/04/20 10:46:20 reyk Exp $ */ +/* $OpenBSD: agentx.c,v 1.5 2014/04/20 16:07:10 reyk Exp $ */ /* * Copyright (c) 2013,2014 Bret Stephen Lambert <blambert@openbsd.org> * @@ -91,7 +91,9 @@ snmp_agentx_open(const char *path, char *descr, struct snmp_oid *oid) bzero(&sun, sizeof(sun)); sun.sun_family = AF_UNIX; - strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >= + sizeof(sun.sun_path)) + goto fail; if (connect(s, (struct sockaddr *)&sun, sizeof(sun)) == -1) goto fail; |