Mail Archives: djgpp-workers/2001/09/24/06:30:14
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 -