BR 2034542: fix crash when touching __FILE__

Touching __FILE__ would cause a dereference of an uninitialized
pointer.  Fix.
This commit is contained in:
H. Peter Anvin 2008-07-31 18:46:11 -07:00
parent f7d863b7d1
commit 932de6c252
2 changed files with 6 additions and 1 deletions

View file

@ -3493,7 +3493,7 @@ again:
if (!m->expansion) {
if (!strcmp("__FILE__", m->name)) {
int32_t num = 0;
char *file;
char *file = NULL;
src_get(&num, &file);
tline->text = nasm_quote(file, strlen(file));
tline->type = TOK_STRING;

5
test/_file_.asm Normal file
View file

@ -0,0 +1,5 @@
;Testname=bin; Arguments=-fbin -o_file_.bin; Files=.stdout .stderr _file_.bin
db __FILE__, `\r\n`
db __FILE__, `\r\n`
dw __LINE__
dw __LINE__