From 7877619f856a04af0519e92780b1d6674a8ff3f7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 15 Jun 2013 23:47:02 +0200 Subject: dotdot: introducing dot file path cleanup RFC3986 details how a path part passed in as part of a URI should be "cleaned" from dot sequences before getting used. The described algorithm is now implemented in lib/dotdot.c with the accompanied test case in test 1395. Bug: http://curl.haxx.se/bug/view.cgi?id=1200 Reported-by: Alex Vinnik --- tests/data/Makefile.am | 2 +- tests/data/test1231 | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/data/test1395 | 26 +++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 tests/data/test1231 create mode 100644 tests/data/test1395 (limited to 'tests/data') diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index e96bc9ba1..ecfee4850 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -93,7 +93,7 @@ test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \ test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \ test1216 test1217 test1218 test1219 \ test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 \ -test1228 test1229 test1230 \ +test1228 test1229 test1230 test1231 \ \ test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \ test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \ diff --git a/tests/data/test1231 b/tests/data/test1231 new file mode 100644 index 000000000..16533a851 --- /dev/null +++ b/tests/data/test1231 @@ -0,0 +1,61 @@ + + + +HTTP +HTTP GET +dotdot removal + + + +# +# Server-side + + +HTTP/1.1 200 OK +Content-Length: 6 +Connection: close + +-foo- + + + +HTTP/1.1 200 OK +Content-Length: 7 +Connection: close + +-cool- + + + +# +# Client-side + + +http + + +HTTP URL with dotdot removal from path + + +http://%HOSTIP:%HTTPPORT/../../hej/but/who/../1231?stupid=me/../1231#soo/../1231 http://%HOSTIP:%HTTPPORT/../../hej/but/who/../12310001#/../12310001 + + + +# +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +GET /hej/but/1231?stupid=me/../1231 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* + +GET /hej/but/12310001 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* + + + + diff --git a/tests/data/test1395 b/tests/data/test1395 new file mode 100644 index 000000000..967c8d492 --- /dev/null +++ b/tests/data/test1395 @@ -0,0 +1,26 @@ + + + +unittest + + + +# +# Client-side + + +none + + +unittest + + +Curl_dedotdotify + + +unit1395 + + + + + -- cgit v1.2.3