wmail: fixed possible NULL-pointer dereference in config-parser.

The code calling Tokenize assumed that if it returned true, value would
not be NULL.  However, in the case of a line containing no equals sign:

  blah

that would not be the case.  Changed Tokenize to return false unless id
and value are both defined.
This commit is contained in:
Jeremy Sowden 2019-06-21 11:50:32 +01:00 committed by Carlos R. Mafra
parent 40d7eb504c
commit dbc178ec3f

View file

@ -124,14 +124,16 @@ static bool Tokenize( const char *line, const char **id, const char **value )
{
token2 = strchr( token1, '=' );
if( token2 != NULL )
{
token2 = SkipWhiteSpaces( token2 + 1 );
if( !IsWhiteSpace( token2 ))
{
*id = token1;
*value = token2;
if( !IsWhiteSpace( token2 ))
{
*id = token1;
*value = token2;
return true;
return true;
}
}
}
}