]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http2:set_transfer_url() return early on OOM
authorDaniel Stenberg <daniel@haxx.se>
Mon, 6 Dec 2021 10:19:52 +0000 (11:19 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 6 Dec 2021 13:32:29 +0000 (14:32 +0100)
If curl_url() returns NULL this should return early to avoid mistakes -
even if right now the subsequent function invokes are all OK.

Coverity (wrongly) pointed out this as a NULL deref.

Closes #8100

lib/http2.c

index 992fbbb26db1078052589e48b4ca4c57dc66cf4f..e74400a4caa0517fdf26a9d24b8e24efaa8cbae0 100644 (file)
@@ -505,10 +505,13 @@ static int set_transfer_url(struct Curl_easy *data,
                             struct curl_pushheaders *hp)
 {
   const char *v;
-  CURLU *u = curl_url();
   CURLUcode uc;
   char *url = NULL;
   int rc = 0;
+  CURLU *u = curl_url();
+
+  if(!u)
+    return 5;
 
   v = curl_pushheader_byname(hp, ":scheme");
   if(v) {