Menu

#62 Missing NULL check for second parameter of strcmp can cause crash on Mac and iOS platforms

0.5.0
closed-fixed
nobody
9
2015-03-06
2013-07-09
stoflow
No

Second parameter of strcmp not NULL-checked before calling in these places :

bool
Value::CZString::operator<( const CZString &other ) const
{
if ( cstr_ )
return strcmp( cstr_, other.cstr_ ) < 0;
return index_ < other.index_;
}

bool
Value::CZString::operator==( const CZString &other ) const
{
if ( cstr_ )
return strcmp( cstr_, other.cstr_ ) == 0;
return index_ == other.index_;
}

Discussion

  • Christopher Dunn

    We use memcmp() now, to allow embedded zeroes in UTF-8: https://github.com/open-source-parsers/jsoncpp/

     
  • Christopher Dunn

    • status: open --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.