File 10813.patch of Package squid-beta
---------------------
PatchSet 10813
Date: 2007/05/19 06:49:12
Author: amosjeffries
Branch: HEAD
Tag: (none)
Log:
Convert three old known points of buffer voilation to use protected code.
Members:
src/SqString.cci:1.1->1.2
Index: squid3/src/SqString.cci
===================================================================
RCS file: /cvsroot/squid/squid3/src/SqString.cci,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- squid3/src/SqString.cci 18 May 2007 06:44:35 -0000 1.1
+++ squid3/src/SqString.cci 19 May 2007 06:49:12 -0000 1.2
@@ -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 @@
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';
}