Check another strlcpy overflow that is very unlikely to happen.
authorreyk <reyk@openbsd.org>
Sun, 20 Apr 2014 16:23:33 +0000 (16:23 +0000)
committerreyk <reyk@openbsd.org>
Sun, 20 Apr 2014 16:23:33 +0000 (16:23 +0000)
usr.sbin/relayd/snmp.c

index e8099b5..2094413 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: snmp.c,v 1.14 2014/04/14 12:58:04 blambert Exp $      */
+/*     $OpenBSD: snmp.c,v 1.15 2014/04/20 16:23:33 reyk Exp $  */
 
 /*
  * Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org>
@@ -97,7 +97,9 @@ snmp_setsock(struct relayd *env, enum privsep_procid id)
 
        bzero(&sun, sizeof(sun));
        sun.sun_family = AF_UNIX;
-       strlcpy(sun.sun_path, env->sc_snmp_path, sizeof(sun.sun_path));
+       if (strlcpy(sun.sun_path, env->sc_snmp_path,
+           sizeof(sun.sun_path)) >= sizeof(sun.sun_path))
+               fatalx("invalid socket path");
 
        socket_set_blockmode(s, BM_NONBLOCK);