Fixes possible crash if url is malicious
Try scan a QR code with content `ss://sdf invalid`, an uncaught exception raises.
This commit is contained in:
@ -56,7 +56,10 @@ void ScanQRCodeOnScreen() {
|
|||||||
NSLog(@"%@", feature.messageString);
|
NSLog(@"%@", feature.messageString);
|
||||||
if ( [feature.messageString hasPrefix:@"ss://"] )
|
if ( [feature.messageString hasPrefix:@"ss://"] )
|
||||||
{
|
{
|
||||||
[foundSSUrls addObject:[NSURL URLWithString:feature.messageString]];
|
NSURL *url = [NSURL URLWithString:feature.messageString];
|
||||||
|
if (url) {
|
||||||
|
[foundSSUrls addObject:url];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CGImageRelease(image);
|
CGImageRelease(image);
|
||||||
|
Reference in New Issue
Block a user