]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_formparse: accept digits in --form type= strings
authorDaniel Stenberg <daniel@haxx.se>
Tue, 17 Dec 2024 06:52:06 +0000 (07:52 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 17 Dec 2024 12:03:34 +0000 (13:03 +0100)
Adjusted test 186 to verify.

Regression in 9664d5a5475fdc66, shipped in 8.11.1

Reported-by: IcedCoffeee on github
Assisted-by: Jay Satiro
Fixes #15761
Closes #15762

src/tool_formparse.c
tests/data/test186

index ddbf1b1a74ac597374f885d4090abe84f0fd3256..814f240e66b18c1b8d820937ca19c25256c49be9 100644 (file)
@@ -495,14 +495,15 @@ static int get_param_part(struct OperationConfig *config, char endchar,
       ;
 
     if(!endct && checkprefix("type=", p)) {
+      size_t tlen;
       for(p += 5; ISSPACE(*p); p++)
         ;
       /* set type pointer */
       type = p;
 
       /* find end of content-type */
-      while(*p && (ISALPHA(*p) || (*p == '/') || (*p == '-')))
-        p++;
+      tlen = strcspn(p, "()<>@,;:\\\"[]?=\r\n ");
+      p += tlen;
       endct = p;
       sep = *p;
     }
index f5c071946f033c88c86abd176802364c9c617f6b..006de790477628c8b7a67fd4c15bc8ae39a7ddd2 100644 (file)
@@ -31,7 +31,7 @@ http
 HTTP RFC1867-type formposting with types on text fields
 </name>
 <command>
-http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -F "name=daniel;type=moo/foo" -F "html= <body>hello</body>;type=text/html;charset=verymoo"
+http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -F "name=daniel;type=moo/foo-.4" -F "html= <body>hello</body>;type=text/html;charset=verymoo"
 </command>
 # We create this file before the command is invoked!
 </client>
@@ -46,12 +46,12 @@ POST /we/want/%TESTNUMBER HTTP/1.1
 Host: %HOSTIP:%HTTPPORT\r
 User-Agent: curl/%VERSION\r
 Accept: */*\r
-Content-Length: 338\r
+Content-Length: 341\r
 Content-Type: multipart/form-data; boundary=----------------------------212d9006ceb5\r
 \r
 ------------------------------212d9006ceb5\r
 Content-Disposition: form-data; name="name"\r
-Content-Type: moo/foo\r
+Content-Type: moo/foo-.4\r
 \r
 daniel\r
 ------------------------------212d9006ceb5\r