From b22336f60c784e6b1813994f432797b365aadb17 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 10 Jun 2014 20:14:43 +0200 Subject: [PATCH] httpc: add checking for NULL scheme and host --- src/httpc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/httpc.c b/src/httpc.c index 1e1f2060..7e2f188a 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -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);