]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Convert three old known points of buffer voilation to use protected code.
authoramosjeffries <>
Sat, 19 May 2007 12:49:12 +0000 (12:49 +0000)
committeramosjeffries <>
Sat, 19 May 2007 12:49:12 +0000 (12:49 +0000)
src/SqString.cci

index d68c0b67dd20d022a317ab35250cccbac209becf..2031b2874fb7b9f056e9462d4eadcd03e293a595 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: SqString.cci,v 1.1 2007/05/18 06:44:35 amosjeffries Exp $
+ * $Id: SqString.cci,v 1.2 2007/05/19 06:49:12 amosjeffries Exp $
  *
  * DEBUG: section 67    String
  * AUTHOR: Duane Wessels
@@ -142,25 +142,22 @@ SqString::compare(SqString const &aString) const
     return strcmp(c_str(), aString.c_str());
 }
 
-/* FIXME: this is can perform buffer overflows and underflows! */
 void
 SqString::set (char const *loc, char const ch)
 {
-    buf_[loc-buf_] = ch;
+    operator[](loc-buf_) = ch;
 }
 
-/* FIXME: this is can perform buffer overflows and underflows! */
 void
 SqString::cut (size_t newLength)
 {
+    operator[](newLength) = '\0';
     len_ = newLength;
-    buf_[newLength] = '\0';
 }
 
-/* FIXME: this is can perform buffer overflows and underflows! */
 void
 SqString::cutPointer (char const *loc)
 {
+    operator[](loc-buf_) = '\0';
     len_ = loc-buf_;
-    buf_[len_] = '\0';
 }