From 44d7d28fe2dd1489046150c2d92ef5946e1e8afd Mon Sep 17 00:00:00 2001 From: reyk Date: Sun, 20 Apr 2014 16:23:33 +0000 Subject: [PATCH] Check another strlcpy overflow that is very unlikely to happen. --- usr.sbin/relayd/snmp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/relayd/snmp.c b/usr.sbin/relayd/snmp.c index e8099b5b648..20944137ade 100644 --- a/usr.sbin/relayd/snmp.c +++ b/usr.sbin/relayd/snmp.c @@ -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 @@ -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); -- 2.20.1