]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP: Appease LGTM finding unlikely user overflow from overself
authorRoy Marples <roy@marples.name>
Sat, 22 Feb 2020 17:07:38 +0000 (17:07 +0000)
committerRoy Marples <roy@marples.name>
Sat, 22 Feb 2020 17:07:38 +0000 (17:07 +0000)
Only in privsep.

src/dhcp.c

index 4015c65f290634ea75ac97d6725f2f860f342721..0c96ea93cf409779432d8f2cf8d3462f04e64718 100644 (file)
@@ -3556,6 +3556,15 @@ dhcp_recvmsg(struct dhcpcd_ctx *ctx, struct msghdr *msg)
        struct interface *ifp;
        const struct dhcp_state *state;
 
+#ifdef PRIVSEP
+       /* Unlikely, but appeases sanitizers. */
+       if (iov->iov_len > FRAMELEN_MAX) {
+               errno = ENOBUFS;
+               logerr(__func__);
+               return;
+       }
+#endif
+
        ifp = if_findifpfromcmsg(ctx, msg, NULL);
        if (ifp == NULL) {
                logerr(__func__);