fix: PICAN openDevice buffer overflow in ifr_name

This commit is contained in:
2026-08-06 17:01:30 +03:00
committed by andrey
parent 449b210d4e
commit 6d75d10ec8
+2 -1
View File
@@ -73,7 +73,8 @@ bool PICAN::openDevice() {
} }
fcntl(sock, F_SETFL, fcntl(sock, F_GETFL) | O_NONBLOCK); fcntl(sock, F_SETFL, fcntl(sock, F_GETFL) | O_NONBLOCK);
ifreq ifr; ifreq ifr;
strcpy(ifr.ifr_name, path().dataAscii()); piZeroMemory(ifr);
strncpy(ifr.ifr_name, path().dataAscii(), sizeof(ifr.ifr_name));
piCout << "PICAN try to get interface index..."; piCout << "PICAN try to get interface index...";
if (ioctl(sock, SIOCGIFINDEX, &ifr) < 0) { if (ioctl(sock, SIOCGIFINDEX, &ifr) < 0) {
piCoutObj << "Error! while determin the interface ioctl"; piCoutObj << "Error! while determin the interface ioctl";