Apache OpenOffice (AOO) Bugzilla – Issue 125112
CStringEqual can return true for non-equal c-strings
Last modified: 2017-05-20 10:35:29 UTC
CStringEqual is a functor for testing whether two C-strings are equal. It has the problem that it returns true if the first string matches the start of the second string. It should only return true when the first string matches the second string fully. No known bug has been introduced by this, but better be safe than sorry.
"hdu" committed SVN revision 1603416 into trunk: #i125112# fix CStringHash functor to match full strings only
Fixed with the commit above. The fix is safe and should be considered for the next bugfix release too.
grant showstopper fix, it is considered as important preventive fix
"hdu" committed SVN revision 1603423 into branches/AOO410: #i125112# fix CStringHash functor to match full strings only
The fix has been merged for the AOO 4.1.1 target.
struct CStringEqual { bool operator()( const char* p1, const char* p2) const { - while( *p1) + while( *p1 != '\0') if( *(p1++) != *(p2++)) return false; - return true; + return (*p2 == '\0'); } }; But if second string p2 is short than p1, is there a acess violation?
It's verified fixed on Windows via build level testing
No special problem found during build level testing on Linux and Mac. So change status to fixed, but please reopen if any related problem found.