From dbc178ec3ffd00d804bec3f415cc3e3bc02045e7 Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Fri, 21 Jun 2019 11:50:32 +0100 Subject: [PATCH] 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. --- wmail/src/config.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wmail/src/config.c b/wmail/src/config.c index e841188..ab0cb00 100644 --- a/wmail/src/config.c +++ b/wmail/src/config.c @@ -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; + } } } }