From b2a767dbcef3d9442d51cc22ffb52804927e473f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 7 Apr 2026 17:01:29 +0200 Subject: [PATCH] gtls: fail for large files in `load_file()` Used for issuer certs. Limit the size at `CURL_MAX_INPUT_LENGTH`, 8MB. Bug: https://github.com/curl/curl/pull/21256#discussion_r3045854654 Closes #21257 --- lib/vtls/gtls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c index 97ac2c8bcf..1b581cda88 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -206,7 +206,7 @@ static gnutls_datum_t load_file(const char *file) if(fseek(f, 0, SEEK_END) != 0) goto out; filelen = ftell(f); - if(filelen < 0) + if(filelen < 0 || filelen > CURL_MAX_INPUT_LENGTH) goto out; if(fseek(f, 0, SEEK_SET) != 0) goto out;