| www.delorie.com/archives/browse.cgi | search |
| 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]" <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: | <oe9e76$1rpa$1@gioia.aioe.org> |
| References: | <CAA2C=vC8s9Kg9LhewQmUMtiJNm+f=Gu5b-m_QXgiTgNufQQpfQ AT mail DOT gmail DOT com> <CAA2C=vBNvQsBU+2_0JhJQqJr41pV=VWTUxgyS29VjUK6zL3paA AT mail DOT gmail DOT com> <CAA2C=vDKwsv7i5jNOGEpOEdokwsWbP3MV_eHU_M6s79cn=NkZg AT mail DOT gmail DOT com> <CAA2C=vC3EtQJmndPY7NRN_cSnDLbNpJPPM2FV6H4E9DcLoWgTg AT mail DOT gmail DOT com> |
| 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]" <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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |