delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/12/17:45:21

Date: Thu, 12 Jun 1997 14:41:41 -0700 (PDT)
Message-Id: <199706122141.OAA12318@adit.ap.net>
Mime-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: DJGPP runs bogus binaries
Cc: djgpp AT delorie DOT com

At 06:10  6/12/1997 +0300, you wrote:
>
>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'.
>
Okay, I suppose so. Maybe a warning to that effect could be inserted in the
docs to save others some grief. Other that that, we'll all just have to be
more careful what's in our Makefiles.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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