X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Martin Str|mberg (ams AT ludd DOT luth DOT se) [via djgpp AT delorie DOT com]" Newsgroups: comp.os.msdos.djgpp Subject: Re: dxe3gen does not handle relocs > 65535 Date: Tue, 2 May 2017 07:58:32 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 22 Message-ID: References: NNTP-Posting-Host: WLZdEp4S2PR09rkVF8ILdg.user.gioia.aioe.org X-Complaints-To: abuse AT aioe DOT org User-Agent: tin/2.2.1-20140504 ("Tober an Righ") (UNIX) (Linux/3.16.0-4-amd64 (x86_64)) X-Notice: Filtered by postfilter v. 0.8.2 Bytes: 1814 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" wrote: > Here is a somewhat cleaned-up patch with a changelog entry: > dxe3gen.c: handle extended relocations. bump version to 1.0.4. ... > diff -u -p -r1.23 dxe3gen.c > --- src/dxe/dxe3gen.c 4 Oct 2015 10:27:26 -0000 1.23 > +++ src/dxe/dxe3gen.c 28 Apr 2017 18:11:10 -0000 > /* Read the relocation table */ > - relocs = (RELOC *)malloc(sc.s_nreloc * sizeof(RELOC)); > fseek(inf, sc.s_relptr, SEEK_SET); > - fread(relocs, RELSZ, sc.s_nreloc, inf); > + if (sc.s_flags & STYP_NRELOC_OVFL) { > + fread(&real_nrelocs, 4, 1, inf); /* read r_vaddr */ > + fseek(inf, RELSZ - 4, SEEK_CUR); /* skip the rest */ You don't check the return value. What if the file is truncated/corrupt? OTOH, perhaps thus praxis is all over dxe, so *shrug*. -- MartinS