summaryrefslogtreecommitdiff
path: root/lib/wildmatch.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2003-07-07 07:07:16 +0000
committerWayne Davison <wayned@samba.org>2003-07-07 07:07:16 +0000
commitfc96552d26e1d5960bcd85fcba4e1631ba15042d (patch)
treee0ba5ae3ffef7ac86ee14dd81e5da3b8332d9d5b /lib/wildmatch.c
parent15bb997d0afd3d1e135f01844097a4a0fc933b5b (diff)
downloadrsync-fc96552d26e1d5960bcd85fcba4e1631ba15042d.tar.gz
rsync-fc96552d26e1d5960bcd85fcba4e1631ba15042d.tar.bz2
rsync-fc96552d26e1d5960bcd85fcba4e1631ba15042d.zip
Don't treat "[:" as the start of a named set if there's no ":]".
Diffstat (limited to 'lib/wildmatch.c')
-rw-r--r--lib/wildmatch.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/wildmatch.c b/lib/wildmatch.c
index 8f7a5236..6bf74c7e 100644
--- a/lib/wildmatch.c
+++ b/lib/wildmatch.c
@@ -143,10 +143,18 @@ static int domatch(const unsigned char *p, const unsigned char *text)
else if (ch == '[' && p[1] == ':') {
unsigned const char *s = p += 2;
int i;
- while ((ch = *p) && (ch != ':' || p[1] != ']')) p++;
+ while ((ch = *p) && ch != ']') p++;
if (!ch)
return ABORT_ALL;
- i = p - s;
+ i = p - s - 1;
+ if (i < 0 || p[-1] != ':') {
+ /* Didn't find ":]", so treat like a normal set. */
+ p = s - 2;
+ ch = '[';
+ if (*text == ch)
+ matched = TRUE;
+ continue;
+ }
if (CC_EQ(s,i, "alnum")) {
if (ISALNUM(*text))
matched = TRUE;
@@ -197,7 +205,6 @@ static int domatch(const unsigned char *p, const unsigned char *text)
}
else /* malformed [:class:] string */
return ABORT_ALL;
- p++;
ch = 0; /* This makes "prev" get set to 0. */
}
else if (*text == ch)