]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix bug #1568 - the assertion on the String having a buffer does not fit with
authorrobertc <>
Sat, 2 Sep 2006 04:57:44 +0000 (04:57 +0000)
committerrobertc <>
Sat, 2 Sep 2006 04:57:44 +0000 (04:57 +0000)
the contract of String.
Note some FIXME's in String.cci.

src/HttpHeader.cc
src/String.cci

index 39fba0ab2f24b1923a330e955ef51f638d91d798..948dd57480e71149817eb4e0486679a5ab419df2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpHeader.cc,v 1.122 2006/06/07 22:39:33 hno Exp $
+ * $Id: HttpHeader.cc,v 1.123 2006/09/01 22:57:44 robertc Exp $
  *
  * DEBUG: section 55    HTTP Header
  * AUTHOR: Alex Rousskov
@@ -831,16 +831,15 @@ HttpHeader::getList(http_hdr_type id) const
     }
 
     /*
-     * note: we might get an empty (len==0) string if there was an "empty"
-     * header; we must not get a NULL string though.
+     * note: we might get an empty (size==0) string if there was an "empty"
+     * header. This results in an empty length String, which may have a NULL
+     * buffer.
      */
-    assert(s.buf());
-
-    /* temporary warning: remove it! @?@ @?@ @?@ */
+    /* temporary warning: remove it? (Is it useful for diagnostics ?) */
     if (!s.size())
-        debug(55, 3) ("empty list header: %s (%d)\n", Headers[id].name.buf(), id);
-
-    debug(55, 6) ("%p: joined for id %d: %s\n", this, id, s.buf());
+        debugs(55, 3, "empty list header: " << Headers[id].name << "(" << id << ")");
+    else
+        debugs(55, 6, this << ": joined for id " << id << ": " << s);
 
     return s;
 }
index eda03415373608c0e08b15ca8c6eca2776c83e1c..4a430658ad1b3bb4fb439ae7cd3cddfb8aaedf38 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: String.cci,v 1.5 2006/05/03 14:04:44 robertc Exp $
+ * $Id: String.cci,v 1.6 2006/09/01 22:57:44 robertc Exp $
  *
  * DEBUG: section 67    String
  * AUTHOR: Duane Wessels
@@ -136,14 +136,14 @@ String::caseCmp (char const *aString, size_t count) const
     return strncasecmp(buf(), aString, count);
 }
 
+/* FIXME: this is can perform buffer overflows and underflows! */
 void
-
-String::set
-    (char const *loc, char const ch)
+String::set (char const *loc, char const ch)
 {
     buf_[loc-buf_] = ch;
 }
 
+/* FIXME: this is can perform buffer overflows and underflows! */
 void
 String::cut (size_t newLength)
 {
@@ -151,6 +151,7 @@ String::cut (size_t newLength)
     buf_[newLength] = '\0';
 }
 
+/* FIXME: this is can perform buffer overflows and underflows! */
 void
 String::cutPointer (char const *loc)
 {