From 574fbf1972935e1d3199cf5ea7efe796fae5d29c Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Thu, 11 Nov 2010 13:44:51 +0300 Subject: [PATCH] preproc: Use nasm_zalloc more To eliminate possible access into heap data Signed-off-by: Cyrill Gorcunov --- preproc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/preproc.c b/preproc.c index 642c54f9..4abddbf1 100644 --- a/preproc.c +++ b/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; -- 2.11.4.GIT