unsigned int max_psk_len)
{
unsigned int psk_len = 0;
+ size_t maxlen = 0;
int ret;
BIGNUM *bn=NULL;
if (c_debug)
BIO_printf(bio_c_out, "psk_client_cb\n");
+ if (max_identity_len > INT_MAX)
+ goto out_err;
+ maxlen = max_identity_len;
if (!hint)
{
/* no ServerKeyExchange message*/
BIO_printf(bio_c_out, "Received PSK identity hint '%s'\n", hint);
/* lookup PSK identity and PSK key based on the given identity hint here */
- ret = BIO_snprintf(identity, max_identity_len, "%s", psk_identity);
- if (ret < 0 || (unsigned int)ret > max_identity_len)
+ ret = snprintf(identity, maxlen, "%s", psk_identity);
+ if (ret == -1 || ret >= maxlen)
goto out_err;
if (c_debug)
BIO_printf(bio_c_out, "created identity '%s' len=%d\n", identity, ret);