[nasm:master] preproc: use explicit addressing while clearing smacro

nasm-bot for Cyrill Gorcunov gorcunov at gmail.com
Sun Oct 4 14:24:03 PDT 2020


Commit-ID:  5e587fda09597b6b697b7d5799562dcc6ca2e4f7
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=5e587fda09597b6b697b7d5799562dcc6ca2e4f7
Author:     Cyrill Gorcunov <gorcunov at gmail.com>
AuthorDate: Mon, 5 Oct 2020 00:09:18 +0300
Committer:  Cyrill Gorcunov <gorcunov at gmail.com>
CommitDate: Mon, 5 Oct 2020 00:09:18 +0300

preproc: use explicit addressing while clearing smacro

Better point out explicitly that SMacro::next member
is untouched, thus do not use SMacro::next and an array.

CID 1432925

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>


---
 asm/preproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/asm/preproc.c b/asm/preproc.c
index 629fe5df..69543174 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -979,7 +979,7 @@ static void clear_smacro(SMacro *s)
 {
     free_smacro_members(s);
     /* Wipe everything except the next pointer */
-    memset(&s->next + 1, 0, sizeof *s - sizeof s->next);
+    memset(&s->name, 0, sizeof(*s) - offsetof(SMacro, name));
 }
 
 /*


More information about the Nasm-commits mailing list