[tbb-commits] [tor-browser] 14/46: Bug 1789808 - Fix buffer overflow, r=necko-reviewers, dragana, a=dmeehan

gitolite role git at cupani.torproject.org
Wed Nov 16 20:42:54 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch base-browser-102.5.0esr-12.0-1
in repository tor-browser.

commit 61f610c453d477cd89fbcd901f29d25f779704a4
Author: Kershaw Chang <kershaw at mozilla.com>
AuthorDate: Tue Oct 18 08:18:20 2022 +0000

    Bug 1789808 - Fix buffer overflow, r=necko-reviewers,dragana, a=dmeehan
    
    Differential Revision: https://phabricator.services.mozilla.com/D158654
---
 netwerk/system/mac/nsNetworkLinkService.mm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/netwerk/system/mac/nsNetworkLinkService.mm b/netwerk/system/mac/nsNetworkLinkService.mm
index 3c829986cc28..8636316421cd 100644
--- a/netwerk/system/mac/nsNetworkLinkService.mm
+++ b/netwerk/system/mac/nsNetworkLinkService.mm
@@ -247,11 +247,14 @@ static bool scanArp(char* ip, char* mac, size_t maclen) {
     if (st == 0 || errno != ENOMEM) {
       break;
     }
-    needed += needed / 8;
 
-    auto tmp = MakeUnique<char[]>(needed);
+    size_t increased = needed;
+    increased += increased / 8;
+
+    auto tmp = MakeUnique<char[]>(increased);
     memcpy(&tmp[0], &buf[0], needed);
     buf = std::move(tmp);
+    needed = increased;
   }
   if (st == -1) {
     return false;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list