]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
rtsold: Use correct error in llflags_get()
authorEric van Gyzen <vangyzen@FreeBSD.org>
Wed, 23 Feb 2022 16:29:53 +0000 (10:29 -0600)
committerEric van Gyzen <vangyzen@FreeBSD.org>
Wed, 2 Mar 2022 21:56:31 +0000 (15:56 -0600)
Set errno to EINVAL if the name overflows the buffer, as was done
before commit ecce515d54bc.

Reviewed by: dab, markj
Fixes: ecce515d54bcea54fea03f731aad646c87761d22
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34354

(cherry picked from commit a2a8efb4f6c15ad0880167cb22452e50aaacf52f)

usr.sbin/rtsold/cap_llflags.c

index 195f83893b4dacb0603634b5cf406429ada79d3a..aea45d9fb8a08e4c88858fb837b1b79fa02f43d0 100644 (file)
@@ -91,7 +91,7 @@ llflags_get(const char *ifname, int *flagsp)
                memset(&ifr6, 0, sizeof(ifr6));
                if (strlcpy(ifr6.ifr_name, ifname, sizeof(ifr6.ifr_name)) >=
                    sizeof(ifr6.ifr_name)) {
-                       error = errno;
+                       error = EINVAL;
                        goto out;
                }
                memcpy(&ifr6.ifr_ifru.ifru_addr, sin6, sin6->sin6_len);