]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1967 fix: avoid new strncmp() that silently converts char* buffers into
authorrousskov <>
Tue, 22 May 2007 22:37:26 +0000 (22:37 +0000)
committerrousskov <>
Tue, 22 May 2007 22:37:26 +0000 (22:37 +0000)
Strings because String length is limited by 64KB and because it is an
expensive conversion.

All similar conversions should be removed, but that is bug #1970.

src/HttpReply.cc

index 3f847d1dc2a854e941bba29396312dbde2755195..04acd852dbd42c047bf774f11f6f014133612ea6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpReply.cc,v 1.93 2007/05/18 06:41:22 amosjeffries Exp $
+ * $Id: HttpReply.cc,v 1.94 2007/05/22 16:37:26 rousskov Exp $
  *
  * DEBUG: section 58    HTTP Reply (Response)
  * AUTHOR: Alex Rousskov
@@ -433,7 +433,7 @@ HttpReply::bodySize(method_t method) const
 
 bool HttpReply::sanityCheckStartLine(MemBuf *buf, http_status *error)
 {
-    if (buf->contentSize() >= protoPrefix.size() && strncmp(protoPrefix, buf->content(), protoPrefix.size()) != 0) {
+    if (buf->contentSize() >= protoPrefix.size() && protoPrefix.compare(buf->content(), protoPrefix.size()) != 0) {
         debugs(58, 3, "HttpReply::sanityCheckStartLine: missing protocol prefix (" << protoPrefix << ") in '" << buf->content() << "'");
         *error = HTTP_INVALID_HEADER;
         return false;