mirror of
https://github.com/curl/curl.git
synced 2026-08-03 13:20:30 +03:00
cookie: fix crash in netscape cookie parsing
- Parse the input string without modifying it. Prior to this change a segfault could occur if the input string was const because the tokenizer modified the input string. For example if the user set CURLOPT_COOKIELIST to a const string then libcurl would likely cause a crash when modifying that string. Even if the string was not const or a crash did not occur there was still the incorrect and unexpected modification of the user's input string. This issue was caused by30da1f59(precedes 8.11.0) which refactored some options parsing and eliminated the copy of the input string. Also, an earlier commitf88cc654incorrectly cast the input pointer when passing it to strtok. Co-authored-by: Daniel Stenberg Closes https://github.com/curl/curl/pull/15826
This commit is contained in:
parent
fabfa8e402
commit
39e21794a7
6 changed files with 157 additions and 29 deletions
|
|
@ -269,7 +269,7 @@ test3008 test3009 test3010 test3011 test3012 test3013 test3014 test3015 \
|
|||
test3016 test3017 test3018 test3019 test3020 test3021 test3022 test3023 \
|
||||
test3024 test3025 test3026 test3027 test3028 test3029 test3030 test3031 \
|
||||
\
|
||||
test3100 test3101 test3102 test3103 \
|
||||
test3100 test3101 test3102 test3103 test3104 \
|
||||
test3200 \
|
||||
test3201 test3202 test3203 test3204 test3205 test3207
|
||||
|
||||
|
|
|
|||
60
tests/data/test3104
Normal file
60
tests/data/test3104
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
cookies
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data crlf="yes">
|
||||
HTTP/1.1 200 OK
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
|
||||
ETag: "21025-dc7-39462498"
|
||||
Accept-Ranges: bytes
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<features>
|
||||
cookies
|
||||
proxy
|
||||
</features>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<tool>
|
||||
lib%TESTNUMBER
|
||||
</tool>
|
||||
<name>
|
||||
CURLOPT_COOKIELIST with netscape format
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol crlf="yes">
|
||||
GET http://example.com/ HTTP/1.1
|
||||
Host: example.com
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Cookie: name=value
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue