From adabc1576b957fc7d929d2c7e749b4f45f7293aa Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Sat, 10 Jul 2010 02:11:41 +0400 Subject: 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. [test: paste.asm] Signed-off-by: Cyrill Gorcunov --- preproc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'preproc.c') diff --git a/preproc.c b/preproc.c index f82ac44a..24fb7947 100644 --- a/preproc.c +++ b/preproc.c @@ -3586,7 +3586,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; } } -- cgit v1.2.1