From 5fc28510a4664f46459d9a40187d81cc08571e60 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 29 Apr 2019 08:00:49 +0200 Subject: CURL_MAX_INPUT_LENGTH: largest acceptable string input size This limits all accepted input strings passed to libcurl to be less than CURL_MAX_INPUT_LENGTH (8000000) bytes, for these API calls: curl_easy_setopt() and curl_url_set(). The 8000000 number is arbitrary picked and is meant to detect mistakes or abuse, not to limit actual practical use cases. By limiting the acceptable string lengths we also reduce the risk of integer overflows all over. NOTE: This does not apply to `CURLOPT_POSTFIELDS`. Test 1559 verifies. Closes #3805 --- tests/data/Makefile.inc | 2 +- tests/data/test1559 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tests/data/test1559 (limited to 'tests/data') diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index d92131a8a..cd99ffae7 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -176,7 +176,7 @@ test1525 test1526 test1527 test1528 test1529 test1530 test1531 test1532 \ test1533 test1534 test1535 test1536 test1537 test1538 \ test1540 test1541 \ test1550 test1551 test1552 test1553 test1554 test1555 test1556 test1557 \ -test1558 test1560 test1561 test1562 \ +test1558 test1559 test1560 test1561 test1562 \ \ test1590 test1591 test1592 \ \ diff --git a/tests/data/test1559 b/tests/data/test1559 new file mode 100644 index 000000000..cbed6fbcc --- /dev/null +++ b/tests/data/test1559 @@ -0,0 +1,44 @@ + + + +CURLOPT_URL + + + + + + + + +none + + +# require HTTP so that CURLOPT_POSTFIELDS works as assumed + +http + + +lib1559 + + + +Set excessive URL lengths + + + +# +# Verify that the test runs to completion without crashing + + +0 + + +CURLOPT_URL 10000000 bytes URL == 43 +CURLOPT_POSTFIELDS 10000000 bytes data == 0 +CURLUPART_URL 10000000 bytes URL == 3 +CURLUPART_SCHEME 10000000 bytes scheme == 3 +CURLUPART_USER 10000000 bytes user == 3 + + + + -- cgit v1.2.3