preproc.c: Fix NULL deref on token pasting

In case if there is a whitespace before
'paste' token we may reach NULL dereference
in strlen since paste_head will point to
TOK_WHITESPACE. Fix it.

[mainstream adabc1576b]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2010-07-10 02:11:41 +04:00
parent a947529954
commit 7d96ac6a56

View File

@ -3594,7 +3594,9 @@ static bool paste_tokens(Token **head, bool handle_paste_tokens)
}
/* else fall through */
default:
tail = paste_head = &t->next;
tail = &t->next;
if (!tok_type_(t->next, TOK_WHITESPACE))
paste_head = tail;
break;
}
}