diff options
author | 2020-12-28 21:41:55 +0000 | |
---|---|---|
committer | 2020-12-28 21:41:55 +0000 | |
commit | b6faad1a1d1550a09bf6ab1f65d45e3ffee10663 (patch) | |
tree | 993ca7bccf9cec0e9da99d6071256387cabfbc6d | |
parent | Add back keyword "any" to match any IP address, which actually works (diff) | |
download | wireguard-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@
-rw-r--r-- | lib/libc/regex/engine.c | 4 | ||||
-rw-r--r-- | regress/lib/libc/regex/tests | 5 |
2 files changed, 6 insertions, 3 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 */ diff --git a/regress/lib/libc/regex/tests b/regress/lib/libc/regex/tests index ee019f0a04f..f400b8575b7 100644 --- a/regress/lib/libc/regex/tests +++ b/regress/lib/libc/regex/tests @@ -1,4 +1,4 @@ -# $OpenBSD: tests,v 1.8 2016/05/26 14:23:55 schwarze Exp $ +# $OpenBSD: tests,v 1.9 2020/12/28 21:41:55 millert Exp $ # $NetBSD: tests,v 1.5 1995/04/20 22:40:00 cgd Exp $ # regular expression test set @@ -592,3 +592,6 @@ Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz a?b - ab ab -\{0,1\}[0-9]*$ b -5 -5 +# FreeBSD PR 130504 +(.|())(b) - ab ab +(()|.)(b) - ab ab |