Hi Chet,

In this commit in the devel branch:

commit 03c8c43b79177fa678714893e9f05b1c517592c0
Author: Chet Ramey <chet.ra...@case.edu>
Date:   Fri Apr 5 09:03:52 2024 -0400

    man page typesetting updates for compatibilityand layout issues

I think there was a typo in execute_cmd.c:

diff --git a/execute_cmd.c b/execute_cmd.c
[...]
 void
 coproc_setvars (struct coproc *cp)
 {
@@ -6072,14 +6073,14 @@ shell_execve (char *command, char **args, char **env)
              interp = getinterp (sample, sample_len, (int *)NULL);
              ilen = strlen (interp);
              errno = i;
-             if (interp[ilen - 1] == '\r')
+             if (interp > 0 && interp[ilen - 1] == '\r')
                {
                  interp = xrealloc (interp, ilen + 2);
                  interp[ilen - 1] = '^';
                  interp[ilen] = 'M';
                  interp[ilen + 1] = '\0';
                }

Shouldn't that condition be something like this:

    if (ilen > 0 && interp[ilen - 1] == '\r')
      {
        /* Rest of code.  */
      }

Since you want to protect against an '#!' without an interpreter
following it. I'm thinking it was just a typo but feel free to correct
me if I am missing something.

Thanks,
Collin

Reply via email to