www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/09/24/06:30:14

X-Authentication-Warning: smtp3.ihug.com.au: Host p36-tnt7.syd.ihug.com.au [203.173.144.36] claimed to be acceleron
Message-ID: <007401c144e3$0fad86e0$0a02a8c0@acceleron>
From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
To: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Cc: <djgpp-workers AT delorie DOT com>
Subject: Re: which crashes
Date: Mon, 24 Sep 2001 20:24:13 +1000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Reply-To: djgpp-workers AT delorie DOT com

Eli,

Just spotted this in the djgpp newsgroup. What about the full_path = at line
199? It looks like this line also has the same problem.

I checked out the differences between Which 2.11 and 2.12 and the changes
are with the man pages only. I couldn't see who produced the DJGPP port as
it has allot of DJGPP changes compared to the original which.c source.

The next time I build the Which package for testing under WIn 2K should I
include these changes? I can also produce a source package as well. This may
save time. Please let me know what you think.

>You didn't show all the relevant sections, I think: the bug only
>raises its ugly head if the environment variable WHICH is set.  This
>is the risk in showing ``only relevant sections'' ;-)
>
>Finally, I'd think the code needs to guard itself better against
>invalid strings in the WHICH variable.  With such a general name, who
>knows what the value might be?..
>
>
>diff -up "which.c~" "which.c"
>--- which.c~ Sun Aug 27 10:08:52 2000
>+++ which.c Sun Sep 23 18:40:26 2001
>@@ -216,7 +216,7 @@ static char *find_command_in_path(const
>          ext = strtok((char *) 0, " ,;")) {
>       // Realloc space for the path + extension
>       // (Do this every time to account for varying length extensions)
>-      full_path = (char *) xrealloc(full_path, 1 + strlen(exts[indx]) +
strlen(full_path));
>+      full_path = (char *) xrealloc(full_path, 1 + strlen(ext) +
strlen(full_path));
>       // Create a pointer to the end of the path
>       full_path_end = full_path + full_path_len;
>       // Copy the extension onto the end of the path
>
>Diff finished at Sun Sep 23 18:48:02


- Raw text -


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