[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55521] trunk/blender/intern/string/ STR_String.h: fix for buffer out-of-bounds reading for STR_String comparisons with char arrays .
Campbell Barton
ideasman42 at gmail.com
Fri Mar 22 22:27:00 CET 2013
Revision: 55521
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55521
Author: campbellbarton
Date: 2013-03-22 21:26:59 +0000 (Fri, 22 Mar 2013)
Log Message:
-----------
fix for buffer out-of-bounds reading for STR_String comparisons with char arrays.
Modified Paths:
--------------
trunk/blender/intern/string/STR_String.h
Modified: trunk/blender/intern/string/STR_String.h
===================================================================
--- trunk/blender/intern/string/STR_String.h 2013-03-22 20:19:55 UTC (rev 55520)
+++ trunk/blender/intern/string/STR_String.h 2013-03-22 21:26:59 UTC (rev 55521)
@@ -187,11 +187,11 @@
inline friend bool operator>=(rcSTR_String lhs, const char *rhs) { return (strcmp(lhs, rhs)>=0); }
inline friend bool operator>=(const char *lhs, rcSTR_String rhs) { return (strcmp(lhs, rhs)>=0); }
inline friend bool operator==(rcSTR_String lhs, rcSTR_String rhs) { return ((lhs.Length() == rhs.Length()) && (memcmp(lhs, rhs, lhs.Length()) == 0)); }
- inline friend bool operator==(rcSTR_String lhs, const char *rhs) { return (memcmp(lhs, rhs, lhs.Length() + 1) == 0); }
- inline friend bool operator==(const char *lhs, rcSTR_String rhs) { return (memcmp(lhs, rhs, rhs.Length() + 1) == 0); }
- inline friend bool operator!=(rcSTR_String lhs, rcSTR_String rhs) { return ((lhs.Length() != rhs.Length()) || (memcmp(lhs, rhs, lhs.Length())!=0)); }
- inline friend bool operator!=(rcSTR_String lhs, const char *rhs) { return (memcmp(lhs, rhs, lhs.Length() + 1) != 0); }
- inline friend bool operator!=(const char *lhs, rcSTR_String rhs) { return (memcmp(lhs, rhs, rhs.Length() + 1) != 0); }
+ inline friend bool operator==(rcSTR_String lhs, const char *rhs) { return (strncmp(lhs, rhs, lhs.Length() + 1) == 0); }
+ inline friend bool operator==(const char *lhs, rcSTR_String rhs) { return (strncmp(lhs, rhs, rhs.Length() + 1) == 0); }
+ inline friend bool operator!=(rcSTR_String lhs, rcSTR_String rhs) { return ((lhs.Length() != rhs.Length()) || (memcmp(lhs, rhs, lhs.Length()) != 0)); }
+ inline friend bool operator!=(rcSTR_String lhs, const char *rhs) { return (strncmp(lhs, rhs, lhs.Length() + 1) != 0); }
+ inline friend bool operator!=(const char *lhs, rcSTR_String rhs) { return (strncmp(lhs, rhs, rhs.Length() + 1) != 0); }
// serializing
//int Serialize(pCStream stream);
More information about the Bf-blender-cvs
mailing list