aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormonnerat <pm@datasphere.ch>2010-04-19 17:37:51 +0200
committermonnerat <pm@datasphere.ch>2010-04-19 17:37:51 +0200
commit7af5e3c39e7399f3a1c2576b575c8aa8781d9f2b (patch)
tree28e595fda7d664fecc66726a4a1c6261e71d2c7c /src
parent42930155ab1ea66d7719b02be71eb1089d1eca47 (diff)
parente5b3246d0a5c08a3afb0d82c96bb4b5ed1e5e159 (diff)
Merge branch 'master' of github.com:bagder/curl
Diffstat (limited to 'src')
-rw-r--r--src/main.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 0670b5f5c..b7e438b1e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4200,9 +4200,26 @@ parse_filename(char *ptr, size_t len)
}
}
- q = strrchr(p, quote);
- if (q)
- *q = 0;
+ if(quote) {
+ /* if the file name started with a quote, then scan for the end quote and
+ stop there */
+ q = strrchr(p, quote);
+ if (q)
+ *q = 0;
+ }
+ else
+ q = NULL; /* no start quote, so no end has been found */
+
+ if(!q) {
+ /* make sure the file name doesn't end in \r or \n */
+ q = strchr(p, '\r');
+ if(q)
+ *q = 0;
+
+ q = strchr(p, '\n');
+ if(q)
+ *q = 0;
+ }
if (copy!=p)
memmove(copy, p, strlen(p)+1);