scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | 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:
Mobjdump/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",