summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2014-12-02 09:25:14 +0000
committerRoy Marples <roy@marples.name>2014-12-02 09:25:14 +0000
commit24b0516e3128200a936fa51c1d08482e92069c6f (patch)
tree980e48492f648f5564f90f016672f5d8c6dc9fcf /dhcpcd.c
parent6b35b393a697823a2704d3c208eacd8b41094c7a (diff)
downloaddhcpcd-24b0516e3128200a936fa51c1d08482e92069c6f.tar.xz
Fix a coverity warning.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c7
1 files changed, 4 insertions, 3 deletions
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);