hsts: accept 10K entries in the list

Up from 1K.

Reduces the risk that someone could flush the list by tricking a user to
do many transfers to new hostnames.

Document the limit.

Follow-up to 03a792b186

Closes #21200
This commit is contained in:
Daniel Stenberg 2026-04-02 08:05:40 +02:00
parent d888a53e14
commit 93e80c75b4
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 27 additions and 12 deletions

View file

@ -18,7 +18,7 @@ HSTS
CURL_TIME=1548369261
</setenv>
<name>
HSTS load more than 1,000 entries from file
HSTS load more than 10k entries from file
</name>
# test 1674 renders the input file itself, then reads it
@ -29,10 +29,10 @@ HSTS load more than 1,000 entries from file
<verify>
<stdout>
Number of entries: 1000
OK
</stdout>
<limits>
Allocations: 1100
Allocations: 11000
</limits>
</verify>
</testcase>

View file

@ -63,7 +63,10 @@ static CURLcode test_unit1674(const char *arg)
Curl_hsts_loadfile(easy, h, arg);
curl_mprintf("Number of entries: %zu\n", Curl_llist_count(&h->list));
if(Curl_llist_count(&h->list) == MAX_HSTS_ENTRIES)
curl_mprintf("OK\n");
else
curl_mprintf("Number of entries: %zu\n", Curl_llist_count(&h->list));
curl_msnprintf(savename, sizeof(savename), "%s.save", arg);
(void)Curl_hsts_save(easy, h, savename);