cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/12/11:11:34

Date: Thu, 12 Jun 1997 18:10:40 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Nate Eldredge <eldredge AT ap DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: DJGPP runs bogus binaries
In-Reply-To: <199706110126.SAA21249@adit.ap.net>
Message-ID: <Pine.SUN.3.91.970612181008.9257O-100000@is>
MIME-Version: 1.0

On Tue, 10 Jun 1997, Nate Eldredge wrote:

> direct_exec_tail in dosexec.c is the entry point for things that DOS is
> going to exec (function 0x4B). A check could be added here that the program
> name ends in ".com" or ".exe". A good place to put this might be around line
> 190, after the TRUENAME call. Any file not ending in these is probably not a
> valid DOS executable.

No, that's wrong IMHO.  There's no reason to prevent a user to do
whatever they want.  DOS doesn't require the executables to have a
certain extension, why should DJGPP?  It is perfectly legal to rename
a .com program to any other extension and still expect it to run.  The
problem is of course exactly that there's no method (known to me) to
detect .com images without relying on the extension.

If the application programmer *knows* that the file they want to
invoke must be one of the executables DJGPP knows about, the
application could always call the `_is_executable' library function
(or more portable `stat') on the file before they call `spawn'.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019