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:
parent
40d7eb504c
commit
dbc178ec3f
|
@ -124,14 +124,16 @@ static bool Tokenize( const char *line, const char **id, const char **value )
|
||||||
{
|
{
|
||||||
token2 = strchr( token1, '=' );
|
token2 = strchr( token1, '=' );
|
||||||
if( token2 != NULL )
|
if( token2 != NULL )
|
||||||
|
{
|
||||||
token2 = SkipWhiteSpaces( token2 + 1 );
|
token2 = SkipWhiteSpaces( token2 + 1 );
|
||||||
|
|
||||||
if( !IsWhiteSpace( token2 ))
|
if( !IsWhiteSpace( token2 ))
|
||||||
{
|
{
|
||||||
*id = token1;
|
*id = token1;
|
||||||
*value = token2;
|
*value = token2;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue