mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
size check before allocating
This commit is contained in:
@@ -2470,21 +2470,21 @@ psk_gnutls_adapter (gnutls_session_t session,
|
||||
&app_psk,
|
||||
&app_psk_size))
|
||||
return -1;
|
||||
if (UINT_MAX < app_psk_size)
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
MHD_DLOG (daemon,
|
||||
_ ("PSK authentication failed: PSK too long.\n"));
|
||||
#endif
|
||||
free (app_psk);
|
||||
return -1;
|
||||
}
|
||||
if (NULL == (key->data = gnutls_malloc (app_psk_size)))
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
MHD_DLOG (daemon,
|
||||
_ ("PSK authentication failed: gnutls_malloc failed to " \
|
||||
"allocate memory.\n"));
|
||||
#endif
|
||||
free (app_psk);
|
||||
return -1;
|
||||
}
|
||||
if (UINT_MAX < app_psk_size)
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
MHD_DLOG (daemon,
|
||||
_ ("PSK authentication failed: PSK too long.\n"));
|
||||
#endif
|
||||
free (app_psk);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user