diff options
author | Martijn van Duren <martijn@cvs.openbsd.org> | 2016-10-11 19:27:40 +0000 |
---|---|---|
committer | Martijn van Duren <martijn@cvs.openbsd.org> | 2016-10-11 19:27:40 +0000 |
commit | ce030013f97d6f05cd88ebf07c07091faf7e7f6b (patch) | |
tree | 2339f49ce8cc891a7ee4a11b3a5d6c894b349d49 /usr.bin | |
parent | 0b380741d1b632c201c71932f1d23c14f9ccdad5 (diff) |
Fix an off by one error when no matches were found in a substitute.
By pfg@ from FreeBSD
OK millert@ and otto@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sed/process.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index 6ccd51dc713..16823ece1f3 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process.c,v 1.28 2016/05/30 18:10:29 martijn Exp $ */ +/* $OpenBSD: process.c,v 1.29 2016/10/11 19:27:39 martijn Exp $ */ /*- * Copyright (c) 1992 Diomidis Spinellis. @@ -404,7 +404,7 @@ substitute(struct s_command *cp) regexec_e(re, ps, REG_NOTBOL, 0, le, psl)); /* Did not find the requested number of matches. */ - if (n > 1) + if (n > 0) return (0); /* Copy the trailing retained string. */ |