From: Roy Marples Date: Tue, 2 Dec 2014 09:25:14 +0000 (+0000) Subject: Fix a coverity warning. X-Git-Tag: v6.6.5~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24b0516e3128200a936fa51c1d08482e92069c6f;p=thirdparty%2Fdhcpcd.git Fix a coverity warning. --- diff --git a/dhcpcd.c b/dhcpcd.c index 5293f971..9e35738f 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -449,12 +449,13 @@ configure_interface1(struct interface *ifp) sizeof(ifo->iaid)); else { uint32_t len; - + len = (uint32_t)strlen(ifp->name); if (len <= sizeof(ifo->iaid)) { memcpy(ifo->iaid, ifp->name, len); - memset(ifo->iaid + len, 0, - sizeof(ifo->iaid) - len); + if (len < sizeof(ifo->iaid)) + memset(ifo->iaid + len, 0, + sizeof(ifo->iaid) - len); } else { /* IAID is the same size as a uint32_t */ len = htonl(ifp->index);