]> git.ozlabs.org Git - ppp.git/commitdiff
pppoe: Fix crash when a too-long device name is given (#447)
authorEivind Næss <eivnaes@yahoo.com>
Thu, 28 Sep 2023 01:09:51 +0000 (18:09 -0700)
committerGitHub <noreply@github.com>
Thu, 28 Sep 2023 01:09:51 +0000 (11:09 +1000)
Fix for github issue #446.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
pppd/plugins/pppoe/if.c

index 87e5f6ec87921e1dd93fff200b2d1d78a1a8d314..4b13ecc19866eed617fa8ce038d8b2b728ceeba2 100644 (file)
@@ -175,7 +175,7 @@ openInterface(char const *ifname, UINT16_t type, unsigned char *hwaddr)
     sa.sll_ifindex = ifr.ifr_ifindex;
 
 #else
-    strcpy(sa.sa_data, ifname);
+    strlcpy(sa.sa_data, ifname, sizeof(sa.sa_data));
 #endif
 
     /* We're only interested in packets on specified interface */
@@ -212,7 +212,7 @@ sendPacket(PPPoEConnection *conn, int sock, PPPoEPacket *pkt, int size)
 #else
     struct sockaddr sa;
 
-    strcpy(sa.sa_data, conn->ifName);
+    strlcpy(sa.sa_data, conn->ifName, sizeof(sa.sa_data));
     err = sendto(sock, pkt, size, 0, &sa, sizeof(sa));
 #endif
     if (err < 0) {