summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/process.c
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2016-10-11 19:27:39 +0000
committermartijn <martijn@openbsd.org>2016-10-11 19:27:39 +0000
commit3cffad6688b33543c95f52cb74d354450089d39e (patch)
tree1d106c418dbf98b1db3d11a240507f6d4a588592 /usr.bin/sed/process.c
parentsync (diff)
downloadwireguard-openbsd-3cffad6688b33543c95f52cb74d354450089d39e.tar.xz
wireguard-openbsd-3cffad6688b33543c95f52cb74d354450089d39e.zip
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/sed/process.c')
-rw-r--r--usr.bin/sed/process.c4
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. */