summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-11-19 14:23:40 +0000
committerMoonchild <moonchild@palemoon.org>2022-11-19 14:23:40 +0000
commit5e6006a2bd1f7ce9561c15b24f4afee9ae6aeb62 (patch)
treed817dd876f1eead20b40c5faa52e2cf6db3f6866
parentac9253e9871b06c91b61fd2f85f435182d490265 (diff)
downloaduxp-5e6006a2bd1f7ce9561c15b24f4afee9ae6aeb62.tar.gz
[network] Fix Mac buffer overflow.
-rw-r--r--netwerk/system/mac/nsNetworkLinkService.mm6
1 files changed, 4 insertions, 2 deletions
diff --git a/netwerk/system/mac/nsNetworkLinkService.mm b/netwerk/system/mac/nsNetworkLinkService.mm
index 5b2d7575ac..30942331d1 100644
--- a/netwerk/system/mac/nsNetworkLinkService.mm
+++ b/netwerk/system/mac/nsNetworkLinkService.mm
@@ -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;