ref: 552e89a27a4cb01785604e7aa049184eb940a996
parent: 3d8ea19c9a097c23e1a55774653909b5ba0d6997
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Jan 19 10:19:32 EST 2020
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.
--- a/src/libmach/coff32/coff32read.c
+++ b/src/libmach/coff32/coff32read.c
@@ -157,8 +157,10 @@
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;