]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
gtls: fail for large files in `load_file()`
authorViktor Szakats <commit@vsz.me>
Tue, 7 Apr 2026 15:01:29 +0000 (17:01 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 7 Apr 2026 18:04:44 +0000 (20:04 +0200)
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

index 97ac2c8bcfd85a4e0f76e93d8bb59dc74cc9306a..1b581cda88e50d5a2b54da0f3bf304f06bddaa2b 100644 (file)
@@ -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;