From 91b203f5f2ae01e477438fb5583fddc978cfed99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Eivind=20N=C3=A6ss?= Date: Wed, 27 Sep 2023 18:09:51 -0700 Subject: [PATCH] pppoe: Fix crash when a too-long device name is given (#447) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix for github issue #446. Signed-off-by: Eivind Næss --- pppd/plugins/pppoe/if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) { -- 2.39.2