From: Steinar H. Gunderson Date: Wed, 15 May 2013 20:26:31 +0000 (+0200) Subject: Fix a possible infinite loop in HTTPInput. X-Git-Tag: 1.0.0~35 X-Git-Url: https://git.sesse.net/?p=cubemap;a=commitdiff_plain;h=861b758382bd863743232da244bc66533658440f Fix a possible infinite loop in HTTPInput. --- 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.