fix NPE
authorSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>
Wed, 6 Jun 2018 07:58:08 +0000 (09:58 +0200)
committerSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>
Wed, 6 Jun 2018 07:58:08 +0000 (09:58 +0200)
src/gns/gnunet-gns-proxy.c

index fb02295c8e2bc32fa2aa9037d6c9ad6ed8700204..cf1901de10413188b9e6d331c6415d192bea8633 100644 (file)
@@ -1965,7 +1965,7 @@ create_response (void *cls,
         us = MHD_lookup_connection_value (con,
                                           MHD_HEADER_KIND,
                                           MHD_HTTP_HEADER_CONTENT_LENGTH);
-        if ( (1 == sscanf (us,
+        if ( (NULL != us) && (1 == sscanf (us,
                            "%ld",
                            &upload_size)) &&
              (upload_size >= 0) )
@@ -1973,6 +1973,10 @@ create_response (void *cls,
           curl_easy_setopt (s5r->curl,
                             CURLOPT_INFILESIZE,
                             upload_size);
+        } else {
+          curl_easy_setopt (s5r->curl,
+                            CURLOPT_INFILESIZE,
+                            upload_size);
         }
       }
     }