]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
vauth/cleartext: fix theoretical integer overflow
authorMajor_Tom <9447735+MajorTomSec@users.noreply.github.com>
Wed, 13 May 2020 19:41:27 +0000 (21:41 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 14 May 2020 06:36:35 +0000 (08:36 +0200)
Fix theoretical integer overflow in Curl_auth_create_plain_message.

The security impact of the overflow was discussed on hackerone. We
agreed this is more of a theoretical vulnerability, as the integer
overflow would only be triggerable on systems using 32-bits size_t with
over 4GB of available memory space for the process.

Closes #5391

lib/vauth/cleartext.c

index 6f452c16942242359c3d1ed538cfd9b911bc9fd2..001f6ea9a91bc58acf4e71d04c0527aa5b9ee046 100644 (file)
@@ -81,7 +81,8 @@ CURLcode Curl_auth_create_plain_message(struct Curl_easy *data,
   plen = strlen(passwd);
 
   /* Compute binary message length. Check for overflows. */
-  if(((zlen + clen) > SIZE_T_MAX/4) || (plen > (SIZE_T_MAX/2 - 2)))
+  if((zlen > SIZE_T_MAX/4) || (clen > SIZE_T_MAX/4) ||
+     (plen > (SIZE_T_MAX/2 - 2)))
     return CURLE_OUT_OF_MEMORY;
   plainlen = zlen + clen + plen + 2;