mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
[network] Fix Mac buffer overflow.
This commit is contained in:
parent
7fab5ebd11
commit
6408291d76
1 changed files with 4 additions and 2 deletions
|
|
@ -181,11 +181,13 @@ static bool scanArp(char *ip, char *mac, size_t maclen)
|
|||
if (st == 0 || errno != ENOMEM) {
|
||||
break;
|
||||
}
|
||||
needed += needed / 8;
|
||||
size_t increased = needed;
|
||||
increased += increased / 8;
|
||||
|
||||
auto tmp = MakeUnique<char[]>(needed);
|
||||
auto tmp = MakeUnique<char[]>(increased);
|
||||
memcpy(&tmp[0], &buf[0], needed);
|
||||
buf = Move(tmp);
|
||||
needed = increased;
|
||||
}
|
||||
if (st == -1) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue