Fix Bug #17806 Segmentation fault when passing invalid url to http_get()
authorMichael Wallner <mike@php.net>
Thu, 5 May 2011 06:02:50 +0000 (06:02 +0000)
committerMichael Wallner <mike@php.net>
Thu, 5 May 2011 06:02:50 +0000 (06:02 +0000)
http_request_api.c

index d328161e13eca231b8dd48a601290d93e695f800..1b0c59e522a2120785601c222ab19c0d24664f13 100644 (file)
@@ -615,7 +615,10 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti
        TSRMLS_FETCH_FROM_CTX(request->tsrm_ls);
        
        HTTP_CHECK_CURL_INIT(request->ch, http_curl_init(request), return FAILURE);
        TSRMLS_FETCH_FROM_CTX(request->tsrm_ls);
        
        HTTP_CHECK_CURL_INIT(request->ch, http_curl_init(request), return FAILURE);
-       
+
+       if (!request->url) {
+               return FAILURE;
+       }
        if (!(storage = http_request_storage_get(request->ch))) {
                return FAILURE;
        }
        if (!(storage = http_request_storage_get(request->ch))) {
                return FAILURE;
        }