[openssh-commits] [openssh] 02/02: upstream: fold consecutive '*' wildcards to mitigate combinatorial

git+noreply at mindrot.org git+noreply at mindrot.org
Wed Nov 4 10:09:31 AEDT 2020


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 05bcd0cadf160fd4826a2284afa7cba6ec432633
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Tue Nov 3 22:53:12 2020 +0000

    upstream: fold consecutive '*' wildcards to mitigate combinatorial
    
    explosion of recursive searches; ok dtucker
    
    OpenBSD-Commit-ID: d18bcb39c40fb8a1ab61153db987e7d11dd3792b
---
 match.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/match.c b/match.c
index 927565c1..3ac854d3 100644
--- a/match.c
+++ b/match.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: match.c,v 1.42 2020/07/05 23:59:45 djm Exp $ */
+/* $OpenBSD: match.c,v 1.43 2020/11/03 22:53:12 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -53,7 +53,6 @@
  * Returns true if the given string matches the pattern (which may contain ?
  * and * as wildcards), and zero if it does not match.
  */
-
 int
 match_pattern(const char *s, const char *pattern)
 {
@@ -63,8 +62,9 @@ match_pattern(const char *s, const char *pattern)
 			return !*s;
 
 		if (*pattern == '*') {
-			/* Skip the asterisk. */
-			pattern++;
+			/* Skip this and any consecutive asterisks. */
+			while (*pattern == '*')
+				pattern++;
 
 			/* If at end of pattern, accept immediately. */
 			if (!*pattern)

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list