From: John Hodge Date: Tue, 14 Jun 2011 15:42:29 +0000 (+0800) Subject: Client - Fix to possible infinite loop in ReadLine X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=586e8014f5d6a588f4614831b53c5d8d8efab4d2;p=tpg%2Fopendispense2.git Client - Fix to possible infinite loop in ReadLine - If the remote host closes, recv() returns 0, this was not checked > Caused 100% CPU on motsugo when un in a backup script --- diff --git a/src/client/main.c b/src/client/main.c index f3ac712..bf22fab 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -2219,7 +2219,7 @@ char *ReadLine(int Socket) } else { len = recv(Socket, buf+bufPos, BUFSIZ-1-bufPos, 0); - if( len < 0 ) { + if( len <= 0 ) { free(ret); return strdup("599 Client Connection Error\n"); }