summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/sed/process.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index d0fac86..93019b4 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -557,7 +557,8 @@ regsub(sp, string, src)
char c, *dst;
#define NEEDSP(reqlen) \
- if (sp->len >= sp->blen - (reqlen) - 1) { \
+ /* XXX What is the +1 for? */ \
+ if (sp->len + (reqlen) + 1 >= sp->blen) { \
sp->blen += (reqlen) + 1024; \
if ((sp->space = sp->back = realloc(sp->back, sp->blen)) \
== NULL) \
OpenPOWER on IntegriCloud