summaryrefslogtreecommitdiffstats
path: root/lib/libc/regex/engine.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2020-12-28 21:41:55 +0000
committermillert <millert@openbsd.org>2020-12-28 21:41:55 +0000
commitb6faad1a1d1550a09bf6ab1f65d45e3ffee10663 (patch)
tree993ca7bccf9cec0e9da99d6071256387cabfbc6d /lib/libc/regex/engine.c
parentAdd back keyword "any" to match any IP address, which actually works (diff)
downloadwireguard-openbsd-b6faad1a1d1550a09bf6ab1f65d45e3ffee10663.tar.xz
wireguard-openbsd-b6faad1a1d1550a09bf6ab1f65d45e3ffee10663.zip
Fix an off-by-one error in the marking of the O_CH operator following
an OOR2 operator. Also includes a regress test for the issue. From FreeBSD via miod@
Diffstat (limited to 'lib/libc/regex/engine.c')
-rw-r--r--lib/libc/regex/engine.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c
index 9d3ca24a800..62da73f99fe 100644
--- a/lib/libc/regex/engine.c
+++ b/lib/libc/regex/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.25 2018/07/11 12:38:46 martijn Exp $ */
+/* $OpenBSD: engine.c,v 1.26 2020/12/28 21:41:55 millert Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994 Henry Spencer.
@@ -935,7 +935,7 @@ step(struct re_guts *g,
OP(s = g->strip[pc+look]) != O_CH;
look += OPND(s))
assert(OP(s) == OOR2);
- FWD(aft, aft, look);
+ FWD(aft, aft, look + 1);
}
break;
case OOR2: /* propagate OCH_'s marking */