summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exec/hashexec.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/exec/hashexec.c b/exec/hashexec.c
index 397f8a0a..11a6c19e 100644
--- a/exec/hashexec.c
+++ b/exec/hashexec.c
@@ -145,10 +145,18 @@ check_hashbang (struct execdata *e,
/* Find the name of the interpreter. */
p = ibuf + strspn (ibuf, " \t");
interp = strsep (&p, " \t");
- /* Skip remaining blanks, and the rest of the line is the argument. */
- p += strspn (p, " \t");
- arg = p;
- len = interp_len - (arg - ibuf);
+
+ if (p)
+ /* Skip remaining blanks, and the rest of the line is the argument. */
+ {
+ p += strspn (p, " \t");
+ arg = p;
+ len = interp_len - (arg - ibuf);
+ }
+ else
+ /* There is no argument. */
+ len = 0;
+
if (len == 0)
arg = NULL;
else