]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
httpc: add checking for NULL scheme and host
authorJaroslav Kysela <perex@perex.cz>
Tue, 10 Jun 2014 18:14:43 +0000 (20:14 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 10 Jun 2014 18:14:43 +0000 (20:14 +0200)
src/httpc.c

index 1e1f20600ac5f265a408d5feb9b629eb14ac8a12..7e2f188a5d4ecf8c36ee1622dec63633733e4aab 100644 (file)
@@ -1198,14 +1198,15 @@ http_client_reconnect
   free(hc->hc_scheme);
   free(hc->hc_host);
 
+  if (scheme == NULL || host == NULL)
+    return -EINVAL;
+
   port           = http_port(scheme, port);
   hc->hc_pevents = 0;
   hc->hc_version = ver;
   hc->hc_scheme  = strdup(scheme);
   hc->hc_host    = strdup(host);
   hc->hc_port    = port;
-  if (port < 0)
-    return -EINVAL;
   hc->hc_fd      = tcp_connect(host, port, hc->hc_bindaddr, errbuf, sizeof(errbuf), -1);
   if (hc->hc_fd < 0) {
     tvhlog(LOG_ERR, "httpc", "Unable to connect to %s:%i - %s", host, port, errbuf);