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:14:24 +0400 |
commit | adabc1576b957fc7d929d2c7e749b4f45f7293aa (patch) | |
tree | 748d3c4559350440cc2a1e6124def81e8de6e422 | |
parent | 8ab945a259e40c2e4dc92e91f8fc78bf7c2e2175 (diff) | |
download | nasm-adabc1576b957fc7d929d2c7e749b4f45f7293aa.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.
[test: paste.asm]
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | preproc.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; } } |