aboutsummaryrefslogtreecommitdiff
path: root/src/tool_cb_hdr.c
diff options
context:
space:
mode:
authorKristiyan Tsaklev <cuki@cukii.tk>2017-10-07 17:47:11 +0300
committerDaniel Stenberg <daniel@haxx.se>2017-10-09 10:37:27 +0200
commitc95c92da7584483368c8761c8cca276b5401530c (patch)
treed1403765e4e043e4b68bfef527c5beea337cf568 /src/tool_cb_hdr.c
parent06cb8adde2ef85c3ac610f93c0fc8a34a3e299b6 (diff)
curl: don't pass semicolons when parsing Content-Disposition
Test 1422 updated to verify. Closes #1964
Diffstat (limited to 'src/tool_cb_hdr.c')
-rw-r--r--src/tool_cb_hdr.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c
index bb982d2e4..7f2181f40 100644
--- a/src/tool_cb_hdr.c
+++ b/src/tool_cb_hdr.c
@@ -161,8 +161,13 @@ static char *parse_filename(const char *ptr, size_t len)
else
stop = ';';
+ /* scan for the end letter and stop there */
+ q = strchr(p, stop);
+ if(q)
+ *q = '\0';
+
/* if the filename contains a path, only use filename portion */
- q = strrchr(copy, '/');
+ q = strrchr(p, '/');
if(q) {
p = q + 1;
if(!*p) {
@@ -183,14 +188,6 @@ static char *parse_filename(const char *ptr, size_t len)
}
}
- /* scan for the end letter and stop there */
- for(q = p; *q; ++q) {
- if(*q == stop) {
- *q = '\0';
- break;
- }
- }
-
/* make sure the file name doesn't end in \r or \n */
q = strchr(p, '\r');
if(q)