mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-31 18:20:22 +08:00
preproc: Use nasm_zalloc more
To eliminate possible access into heap data Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
a22e7a983c
commit
574fbf1972
12
preproc.c
12
preproc.c
@ -2117,7 +2117,7 @@ static bool define_smacro(Context *ctx, const char *mname, bool casesense,
|
||||
} else {
|
||||
smtbl = ctx ? &ctx->localmac : &smacros;
|
||||
smhead = (SMacro **) hash_findi_add(smtbl, mname);
|
||||
smac = nasm_malloc(sizeof(SMacro));
|
||||
smac = nasm_zalloc(sizeof(SMacro));
|
||||
smac->next = *smhead;
|
||||
*smhead = smac;
|
||||
}
|
||||
@ -2637,7 +2637,7 @@ static int do_directive(Token * tline)
|
||||
}
|
||||
|
||||
if (i == PP_PUSH) {
|
||||
ctx = nasm_malloc(sizeof(Context));
|
||||
ctx = nasm_zalloc(sizeof(Context));
|
||||
ctx->next = cstk;
|
||||
hash_init(&ctx->localmac, HASH_SMALL);
|
||||
ctx->name = p;
|
||||
@ -2873,11 +2873,9 @@ issue_error:
|
||||
|
||||
eed = (ExpDef *) hash_findix(&expdefs, ed->name);
|
||||
while (eed) {
|
||||
if (!strcmp(eed->name, ed->name) &&
|
||||
(eed->nparam_min <= ed->nparam_max
|
||||
|| ed->plus)
|
||||
&& (ed->nparam_min <= eed->nparam_max
|
||||
|| eed->plus)) {
|
||||
if (!strcmp(eed->name, ed->name) &&
|
||||
(eed->nparam_min <= ed->nparam_max || ed->plus) &&
|
||||
(ed->nparam_min <= eed->nparam_max || eed->plus)) {
|
||||
error(ERR_WARNING|ERR_PASS1,
|
||||
"redefining multi-line macro `%s'", ed->name);
|
||||
return DIRECTIVE_FOUND;
|
||||
|
Loading…
x
Reference in New Issue
Block a user