liblinphone: fix potential crash when interpretting URLs

This commit is contained in:
Gautier Pelloux-Prayer 2015-10-28 09:39:43 +01:00
parent ca1b67f8e7
commit 627e8d8081
3 changed files with 10 additions and 6 deletions

View file

@ -150,7 +150,8 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
- (void)addCurrentContactContactField:(NSString *)address {
LinphoneAddress *linphoneAddress = linphone_address_new(address.UTF8String);
NSString *username = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)];
NSString *username =
linphoneAddress ? [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)] : address;
if (([username rangeOfString:@"@"].length > 0) &&
([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true)) {
@ -161,7 +162,8 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
} else {
[tableController addSipField:address];
}
linphone_address_destroy(linphoneAddress);
if (linphoneAddress)
linphone_address_destroy(linphoneAddress);
[self enableEdit:FALSE];
[[tableController tableView] reloadData];

View file

@ -961,8 +961,10 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
} else {
if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true) {
LinphoneAddress *linphoneAddress = linphone_address_new([address UTF8String]);
address = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)];
linphone_address_destroy(linphoneAddress);
if (linphoneAddress) {
address = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)];
linphone_address_destroy(linphoneAddress);
}
}
}
if (address == nil) {

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UICallBar">