Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't treat "[:" as the start of a named set if there's no ":]".
[rsync/rsync.git]
/
lib
/
wildmatch.c
diff --git
a/lib/wildmatch.c
b/lib/wildmatch.c
index
8f7a523
..
6bf74c7
100644
(file)
--- 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;
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;
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;
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;
}
else /* malformed [:class:] string */
return ABORT_ALL;
- p++;
ch = 0; /* This makes "prev" get set to 0. */
}
else if (*text == ch)
ch = 0; /* This makes "prev" get set to 0. */
}
else if (*text == ch)