mirror of git://anongit.mindrot.org/openssh.git
upstream: fold consecutive '*' wildcards to mitigate combinatorial
explosion of recursive searches; ok dtucker OpenBSD-Commit-ID: d18bcb39c40fb8a1ab61153db987e7d11dd3792b
This commit is contained in:
parent
7d680448db
commit
05bcd0cadf
6
match.c
6
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@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
|
@ -53,7 +53,6 @@
|
||||||
* Returns true if the given string matches the pattern (which may contain ?
|
* Returns true if the given string matches the pattern (which may contain ?
|
||||||
* and * as wildcards), and zero if it does not match.
|
* and * as wildcards), and zero if it does not match.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
match_pattern(const char *s, const char *pattern)
|
match_pattern(const char *s, const char *pattern)
|
||||||
{
|
{
|
||||||
|
@ -63,7 +62,8 @@ match_pattern(const char *s, const char *pattern)
|
||||||
return !*s;
|
return !*s;
|
||||||
|
|
||||||
if (*pattern == '*') {
|
if (*pattern == '*') {
|
||||||
/* Skip the asterisk. */
|
/* Skip this and any consecutive asterisks. */
|
||||||
|
while (*pattern == '*')
|
||||||
pattern++;
|
pattern++;
|
||||||
|
|
||||||
/* If at end of pattern, accept immediately. */
|
/* If at end of pattern, accept immediately. */
|
||||||
|
|
Loading…
Reference in New Issue