mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-12-15 09:09:58 +08:00
BR 3392576: don't segfault on a bad %pragma limit
Don't segfault on a bad %pragma limit. Instead treat a NULL pointer as an empty string. Reported-by: Ren Kimura <rkx1209dev@gmail.com> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
parent
480d5e2c8b
commit
93d41d8296
@ -212,6 +212,11 @@ nasm_set_limit(const char *limit, const char *valstr)
|
||||
bool rn_error;
|
||||
int errlevel;
|
||||
|
||||
if (!limit)
|
||||
limit = "";
|
||||
if (!valstr)
|
||||
valstr = "";
|
||||
|
||||
for (i = 0; i <= LIMIT_MAX; i++) {
|
||||
if (!nasm_stricmp(limit, limit_info[i].name))
|
||||
break;
|
||||
@ -234,7 +239,7 @@ nasm_set_limit(const char *limit, const char *valstr)
|
||||
errlevel = ERR_WARNING|WARN_OTHER|ERR_USAGE;
|
||||
else
|
||||
errlevel = ERR_WARNING|WARN_PRAGMA_BAD;
|
||||
nasm_error(errlevel, "invalid limit value: `%s'", limit);
|
||||
nasm_error(errlevel, "invalid limit value: `%s'", valstr);
|
||||
return DIRR_ERROR;
|
||||
}
|
||||
if (val > LIMIT_MAX_VAL)
|
||||
|
Loading…
Reference in New Issue
Block a user