commit 552e89a27a4cb01785604e7aa049184eb940a996
parent 3d8ea19c9a097c23e1a55774653909b5ba0d6997
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 19 Jan 2020 15:19:32 +0100
libmach: Fix readstr()
Readstr() must check for size 4 because the 4 bytes
with the size of the string table is included in the
size of the string table.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libmach/coff32/coff32read.c b/src/libmach/coff32/coff32read.c
@@ -157,8 +157,10 @@ readstr(Obj *obj, FILE *fp)
coff->strsiz = 0;
if (siz < 4 || siz > SIZE_MAX) {
errno = ERANGE;
- return 1;
+ return 0;
}
+ if (siz == 4)
+ return 1;
if ((str = malloc(siz)) == NULL)
return 0;