Commit 61e991b1 authored by François Grisez's avatar François Grisez

Fix crash when passing "http://" as remote provisioning URI

parent 55da1bdb
......@@ -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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment