commit 3703ba5fe4d255ac4918021108f8d6a339131bde
parent a64b35f219113878d8021e102df5630841cce9e4
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;