[nasm:master] rdoff/ldrdf.c: fix memory overflow errors causing build failures

nasm-bot for H. Peter Anvin hpa at zytor.com
Mon Nov 7 17:12:30 PST 2022


Commit-ID:  67fbb458165c60e7149d81555e8144a8ad4b0191
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=67fbb458165c60e7149d81555e8144a8ad4b0191
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 5 Oct 2022 12:00:57 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 5 Oct 2022 12:00:57 -0700

rdoff/ldrdf.c: fix memory overflow errors causing build failures

The RDOFF tools are fundamentally broken to the core: they are
defining headers which contain misaligned structure members, which
cause the compiler to add padding, breaking the format.

This is just a build fix; remove RDOFF in 2.16.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 rdoff/ldrdf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rdoff/ldrdf.c b/rdoff/ldrdf.c
index a78c4504..f45294db 100644
--- a/rdoff/ldrdf.c
+++ b/rdoff/ldrdf.c
@@ -735,7 +735,7 @@ static void write_output(const char *filename)
             printf("\nadding generic record from binary file %s\n",
                    generic_rec_file);
 
-        hr = (rdfheaderrec *) nasm_malloc(sizeof(struct GenericRec));
+        nasm_new(hr);
         if ((ff = fopen(generic_rec_file, "r")) == NULL) {
             fprintf(stderr, "ldrdf: couldn't open %s for input\n",
                     generic_rec_file);
@@ -772,7 +772,7 @@ static void write_output(const char *filename)
         if (options.verbose)
             printf("\nadding module name record %s\n", modname_specified);
 
-        hr = (rdfheaderrec *) nasm_malloc(sizeof(struct ModRec));
+        nasm_new(hr);
 	hr->m.type = RDFREC_MODNAME;
         hr->m.reclen = n + 1;
         strcpy(hr->m.modname, modname_specified);


More information about the Nasm-commits mailing list