Bug 654725 - Changes in OS X 10.7 break our Wi-Fi monitor code, causing crashes (followup fix). r=josh
authorSteven Michaud <smichaud@pobox.com>
Wed, 11 May 2011 15:05:28 -0500
changeset 69357 f209ae2ce125b486909752725e1b2aca638168d4
parent 69356 427fa3603d4c19dda278b996c6777297fea6ae37
child 69358 6eb2b03b6fd5eddb8c2fd735b1ee4ae4a906c0bd
push idunknown
push userunknown
push dateunknown
reviewersjosh
bugs654725
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 654725 - Changes in OS X 10.7 break our Wi-Fi monitor code, causing crashes (followup fix). r=josh
netwerk/wifi/osx_corewlan.mm
--- a/netwerk/wifi/osx_corewlan.mm
+++ b/netwerk/wifi/osx_corewlan.mm
@@ -107,17 +107,22 @@ GetAccessPointsFromWLAN(nsCOMArray<nsWif
           memcpy(macData, [data bytes], 6);
         }
       } else {
         // [CWInterface bssid] returns a string formatted "00:00:00:00:00:00".
         NSString* macString = [anObject bssid];
         if (macString && ([macString length] == 17)) {
           for (NSUInteger i = 0; i < 6; ++i) {
             NSString* part = [macString substringWithRange:NSMakeRange(i * 3, 2)];
-            macData[i] = (unsigned char) [part integerValue];
+            NSScanner* scanner = [NSScanner scannerWithString:part];
+            unsigned int data = 0;
+            if (![scanner scanHexInt:&data]) {
+              data = 0;
+            }
+            macData[i] = (unsigned char) data;
           }
         }
       }
 
       // [CWInterface rssiValue] is available on OS X 10.7 and up (and
       // [CWInterface rssi] is deprecated).
       int signal = 0;
       if ([anObject respondsToSelector:@selector(rssiValue)]) {