scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit d21dc62bd4af1887ec743aa6f16550b2a474ad7f
parent 92ff27f9ece894a9fe6f426a97120a24d536457f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 28 Nov 2017 08:54:57 +0000

[objdump] Validate the magic number of the object file

Diffstat:
objdump/main.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/objdump/main.c b/objdump/main.c @@ -189,6 +189,12 @@ dump(char *fname) goto wrong_file; if (rdmyrohdr(fp, &hdr) < 0) goto wrong_file; + if (strncmp(hdr.magic, MYROMAGIC, MYROMAGIC_SIZ)) { + fprintf(stderr, + "objdump: %s: File format not recognized\n", + fname); + goto close_file; + } if (hdr.strsize > SIZE_MAX) { fprintf(stderr, "objdump: %s: overflow in header\n",