Harden against Iceweasel bug: read until we find a newline.
[citadel.git] / webcit / tcp_sockets.c
index c9d053f2f796b1ca4bf897e2e347675d506d0201..7db07943d4dd9210ba5b2fac3163f205e247d4f5 100644 (file)
@@ -448,7 +448,8 @@ int ClientGetLine(ParsedHttpHdrs *Hdr, StrBuf *Target)
 
        if (is_https) {
                int ntries = 0;
-               if (StrLength(Hdr->ReadBuf) > 0) {
+               if (StrLength(Hdr->ReadBuf) > 0)
+               {
                        pchs = ChrPtr(Hdr->ReadBuf);
                        pch = strchr(pchs, '\n');
                        if (pch != NULL) {
@@ -471,6 +472,8 @@ int ClientGetLine(ParsedHttpHdrs *Hdr, StrBuf *Target)
                                        retval = client_read_sslbuffer(Hdr->ReadBuf, SLEEPING);
                                        pchs = ChrPtr(Hdr->ReadBuf);
                                        pch = strchr(pchs, '\n');
+                                       if (pch == NULL)
+                                               retval = 0;
                                }
                                if (retval == 0) {
                                        sleeeeeeeeeep(1);