summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/sed/process.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index f7d730d..d0fac86 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -362,10 +362,7 @@ substitute(cp)
slen -= match[0].rm_eo;
lastempty = 0;
} else {
- if (match[0].rm_so == 0)
- cspace(&SS, s, match[0].rm_so + 1,
- APPEND);
- else
+ if (match[0].rm_so < slen)
cspace(&SS, s + match[0].rm_so, 1,
APPEND);
s += match[0].rm_so + 1;
OpenPOWER on IntegriCloud