diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-04-20 16:07:11 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-04-20 16:07:11 +0000 |
commit | aaa13fbb9038c7850ab0ad9d2a7e61f6b25a56ed (patch) | |
tree | 5aa3a13c9421eba629258fe9ceda40dfba69ac7d /usr.sbin/relayd/agentx.c | |
parent | 6c26ef989af54f261bfb1fdb6863923eca23bcb9 (diff) |
Just to be pedantic, fail if strlcpy managed to overflow the socket path.
Diffstat (limited to 'usr.sbin/relayd/agentx.c')
-rw-r--r-- | usr.sbin/relayd/agentx.c | 6 |
1 files changed, 4 insertions, 2 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; |