mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 13:08:08 +00:00
Fix crash when passing "http://" as remote provisioning URI
This commit is contained in:
parent
64034b2662
commit
52a134ca70
1 changed files with 3 additions and 2 deletions
|
|
@ -103,13 +103,14 @@ int linphone_remote_provisioning_download_and_apply(LinphoneCore *lc, const char
|
|||
|
||||
belle_generic_uri_t *uri=belle_generic_uri_parse(remote_provisioning_uri);
|
||||
const char* scheme = uri ? belle_generic_uri_get_scheme(uri) : NULL;
|
||||
const char *host = uri ? belle_generic_uri_get_host(uri) : NULL;
|
||||
|
||||
if( scheme && (strcmp(scheme,"file") == 0) ){
|
||||
// We allow for 'local remote-provisioning' in case the file is to be opened from the hard drive.
|
||||
const char* file_path = remote_provisioning_uri + strlen("file://"); // skip scheme
|
||||
return linphone_remote_provisioning_load_file(lc, file_path);
|
||||
|
||||
} else if( scheme && strncmp(scheme, "http", 4) == 0 ) {
|
||||
} else if( scheme && strncmp(scheme, "http", 4) == 0 && host && strlen(host) > 0) {
|
||||
belle_http_request_listener_callbacks_t belle_request_listener={0};
|
||||
belle_http_request_listener_t *listener;
|
||||
belle_http_request_t *request;
|
||||
|
|
@ -124,7 +125,7 @@ int linphone_remote_provisioning_download_and_apply(LinphoneCore *lc, const char
|
|||
request=belle_http_request_create("GET",uri, NULL);
|
||||
return belle_http_provider_send_request(lc->http_provider, request, listener);
|
||||
} else {
|
||||
ms_error("Invalid provisioning URI [%s] (missing scheme?)",remote_provisioning_uri);
|
||||
ms_error("Invalid provisioning URI [%s] (missing scheme or host ?)",remote_provisioning_uri);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue