From: Eivind Næss Date: Thu, 28 Sep 2023 01:09:51 +0000 (-0700) Subject: pppoe: Fix crash when a too-long device name is given (#447) X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=91b203f5f2ae01e477438fb5583fddc978cfed99 pppoe: Fix crash when a too-long device name is given (#447) Fix for github issue #446. Signed-off-by: Eivind Næss --- diff --git a/pppd/plugins/pppoe/if.c b/pppd/plugins/pppoe/if.c index 87e5f6e..4b13ecc 100644 --- a/pppd/plugins/pppoe/if.c +++ b/pppd/plugins/pppoe/if.c @@ -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) {