]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib1537: check ptr against NULL before dereferencing it
authorkokke <spam@rowdy.dk>
Tue, 9 Mar 2021 13:10:41 +0000 (14:10 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 10 Mar 2021 13:01:55 +0000 (14:01 +0100)
Fixes #6707
Closes #6708

tests/libtest/lib1537.c

index cca3b91a43ae26d4e29ae067ee9f562842c9bdb2..7ba8e225b9304e636f3ce0495db07b8047e499a0 100644 (file)
@@ -47,11 +47,11 @@ int test(char *URL)
 
   /* deprecated API */
   ptr = curl_escape((char *)a, asize);
-  printf("%s\n", ptr);
   if(!ptr) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
+  printf("%s\n", ptr);
 
   raw = curl_easy_unescape(NULL, ptr, (int)strlen(ptr), &outlen);
   printf("outlen == %d\n", outlen);