[FFmpeg-devel,4/5] lavf/tls: apply numerichost check to verifyhost

Submitted by Rodger Combs on Jan. 18, 2019, 8:46 a.m.

Details

Message ID 20190118084604.82324-4-rodger.combs@gmail.com
State New
Headers show

Commit Message

Rodger Combs Jan. 18, 2019, 8:46 a.m.
---
 libavformat/tls.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/tls.c b/libavformat/tls.c
index 10e0792e29..a6dcd3cc96 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -80,15 +80,15 @@  int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV
 
     ff_url_join(buf, sizeof(buf), "tcp", NULL, c->underlying_host, port, "%s", p);
 
+    if (!c->host && !(c->host = av_strdup(c->underlying_host)))
+        return AVERROR(ENOMEM);
+
     hints.ai_flags = AI_NUMERICHOST;
-    if (!getaddrinfo(c->underlying_host, NULL, &hints, &ai)) {
+    if (!getaddrinfo(c->host, NULL, &hints, &ai)) {
         c->numerichost = 1;
         freeaddrinfo(ai);
     }
 
-    if (!c->host && !(c->host = av_strdup(c->underlying_host)))
-        return AVERROR(ENOMEM);
-
     proxy_path = getenv("http_proxy");
     use_proxy = !ff_http_match_no_proxy(getenv("no_proxy"), c->underlying_host) &&
                 proxy_path && av_strstart(proxy_path, "http://", NULL);