summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--preproc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/preproc.c b/preproc.c
index 8400773b..fdb9fc19 100644
--- a/preproc.c
+++ b/preproc.c
@@ -1269,9 +1269,13 @@ static char *detoken(Token * tlist, bool expand_locals)
if (!p) {
nasm_error(ERR_NONFATAL | ERR_PASS1,
"nonexistent environment variable `%s'", v);
- p = "";
- }
- t->text = nasm_strdup(p);
+ /*
+ * FIXME We better should investigate if accessing
+ * ->text[1] without ->text[0] is safe enough.
+ */
+ t->text = nasm_zalloc(2);
+ } else
+ t->text = nasm_strdup(p);
}
nasm_free(q);
}