summaryrefslogtreecommitdiffstats
path: root/bin/sh/expand.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/expand.c')
-rw-r--r--bin/sh/expand.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index f1d0d69..8d62830 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -397,12 +397,12 @@ expari(flag)
CHECKSTRSPACE(12 - 2, expdest);
USTPUTC('\0', expdest);
start = stackblock();
- p = expdest;
- while (*p != CTLARI && p >= start)
+ p = expdest - 2;
+ while (p >= start && *p != CTLARI)
--p;
- if (*p != CTLARI)
+ if (p < start || *p != CTLARI)
error("missing CTLARI (shouldn't happen)");
- if (p > start && *(p-1) == CTLESC)
+ if (p > start && *(p - 1) == CTLESC)
for (p = start; *p != CTLARI; p++)
if (*p == CTLESC)
p++;
OpenPOWER on IntegriCloud