From 46115862ece2cbd590bc4ae6fe06767869fa7668 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 20 May 2013 15:47:41 +0200 Subject: [PATCH 1/1] Fix a possible corruption/crash when name lookups fail, due to incorrect error checking of the getaddrinfo() result. --- httpinput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpinput.cpp b/httpinput.cpp index 301aa3f..19167f0 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -86,7 +86,7 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port) { addrinfo *ai; int err = getaddrinfo(host.c_str(), port.c_str(), NULL, &ai); - if (err == -1) { + if (err != 0) { log(WARNING, "[%s] Lookup of '%s' failed (%s).", url.c_str(), host.c_str(), gai_strerror(err)); return -1; -- 2.39.2