diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-07-10 02:11:41 +0400 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-07-10 02:34:05 +0400 |
commit | 7d96ac6a567df5075e3f4f4019d6d24727db8361 (patch) | |
tree | cdc2011728225880d016ae04ca937ed95e6cd62c | |
parent | a947529954d9db0214e65d2c856111f823381f7c (diff) | |
download | nasm-7d96ac6a567df5075e3f4f4019d6d24727db8361.tar.gz |
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 adabc1576b957fc7d929d2c7e749b4f45f7293aa]
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | preproc.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; } } |