From 861b758382bd863743232da244bc66533658440f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 15 May 2013 22:26:31 +0200 Subject: [PATCH] Fix a possible infinite loop in HTTPInput. --- httpinput.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/httpinput.cpp b/httpinput.cpp index cc618bc..301aa3f 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -95,7 +95,7 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port) addrinfo *base_ai = ai; // Connect to everything in turn until we have a socket. - while (ai && !should_stop()) { + for ( ; ai && !should_stop(); ai = ai->ai_next) { int sock = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP); if (sock == -1) { // Could be e.g. EPROTONOSUPPORT. The show must go on. @@ -153,7 +153,6 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port) } safe_close(sock); - ai = ai->ai_next; } // Give the last one as error. -- 2.39.2