summaryrefslogtreecommitdiff
path: root/src/urlglob.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-03-06 22:52:00 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-03-06 22:52:00 +0000
commit4441df90c1d160827f657e6c11a48b8e71e3f49a (patch)
treeb0aefe69f0152345794697b4863ebc4b1406f829 /src/urlglob.c
parentf51f2417c59615da5a08cf3165c88cb103b1733f (diff)
downloadcurl-4441df90c1d160827f657e6c11a48b8e71e3f49a.tar.gz
Kevin Roth nicely saved us from this backslash-removing problem!
Diffstat (limited to 'src/urlglob.c')
-rw-r--r--src/urlglob.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/urlglob.c b/src/urlglob.c
index 48108c88c..4ab3258b2 100644
--- a/src/urlglob.c
+++ b/src/urlglob.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
@@ -222,15 +222,19 @@ GlobCode glob_word(URLGlob *glob, char *pattern, int pos, int *amount)
*amount = 1; /* default is one single string */
while (*pattern != '\0' && *pattern != '{' && *pattern != '[') {
- if (*pattern == '}' || *pattern == ']') {
+ if (*pattern == '}' || *pattern == ']')
return GLOB_ERROR;
- }
- if (*pattern == '\\') { /* escape character, skip '\' */
+
+ /* only allow \ to escape known "special letters" */
+ if (*pattern == '\\' &&
+ (*(pattern+1) == '{' || *(pattern+1) == '[' ||
+ *(pattern+1) == '}' || *(pattern+1) == ']') ) {
+
+ /* escape character, skip '\' */
++pattern;
++pos;
- if (*pattern == '\0') { /* but no escaping of '\0'! */
+ if (*pattern == '\0') /* but no escaping of '\0'! */
return GLOB_ERROR;
- }
}
*buf++ = *pattern++; /* copy character to literal */
++pos;