ref: b1b925a092fd55df9eaf6a05fe5f03a4ec4f8378
parent: 39dff9f7b0cb26421d0b67fc003fdda8db867e0b
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Feb 26 00:10:29 EST 2019
[libmach] Fix coff32getsect() The pointer to the section was not updated and the same section was exported several times.
--- a/src/libmach/coff32/coff32getsect.c
+++ b/src/libmach/coff32/coff32getsect.c
@@ -19,7 +19,6 @@
coff = obj->data;
hdr = &coff->hdr;
- scn = coff->scns;
secs = malloc(sizeof(Objsect) * hdr->f_nscns);
if (!secs)
@@ -28,6 +27,8 @@
for (i = 0; i < hdr->f_nscns; i++) {
sp = &secs[i];
sp->next = (i < hdr->f_nscns-1) ? &secs[i+1] : NULL;
+ scn = &coff->scns[i];
+ flags = scn->s_flags;
if (flags & STYP_TEXT) {
type = 'T';
@@ -66,6 +67,7 @@
sp->offset = scn->s_scnptr;
sp->size = scn->s_size;
sp->type = type;
+ sp->flags = sflags;
sp->align = 4; /* TODO: Check how align is defined in coff */
}
obj->secs = secs;