* set correct buffer end pointer, so we don't run into unknown ground
[citadel.git] / webcit / context_loop.c
index 43adf38dd536b6eed464f2c850599b9486687e93..e0577d7eb4585aa4b720a69d08135aba51c6dc03 100644 (file)
@@ -411,9 +411,10 @@ int ReadHTTPRequest (ParsedHttpHdrs *Hdr)
                StrBufExtract_token(HeaderName, Line, 0, ':');
 
                pchs = ChrPtr(Line);
+               pche = pchs + StrLength(Line);
                pch = pchs + StrLength(HeaderName) + 1;
                pche = pchs + StrLength(Line);
-               while (isspace(*pch) && (pch < pche))
+               while ((pch < pche) && isspace(*pch))
                        pch ++;
                StrBufCutLeft(Line, pch - pchs);