summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2017-10-22 21:42:59 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2017-10-22 21:42:59 +0300
commit9b7ee09abfd426b99aa1ea81d19a3b2818eeabf9 (patch)
treede70785d6b73d21d1da0c4b71bf04f9b44bcdb74
parent6f8109ebf18e3de69a8a2ad63867fe8498e49bf0 (diff)
downloadnasm-9b7ee09abfd426b99aa1ea81d19a3b2818eeabf9.tar.gz
prepoc: Fix heap-buffer-overflow in detoken
Just make sure we've a data to process. https://bugzilla.nasm.us/show_bug.cgi?id=3392424 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--asm/preproc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/asm/preproc.c b/asm/preproc.c
index 9642edcb..475926d8 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -1254,7 +1254,8 @@ static char *detoken(Token * tlist, bool expand_locals)
int len = 0;
list_for_each(t, tlist) {
- if (t->type == TOK_PREPROC_ID && t->text[1] == '!') {
+ if (t->type == TOK_PREPROC_ID && t->text &&
+ t->text[0] && t->text[1] == '!') {
char *v;
char *q = t->text;