obs-outputs: Add bounds checking to b64enc

This fixes "warning: unused parameter 'maxsize' [-Wunused-parameter]"
introduced when authentication was turned on.
master
Jess Mayo 2015-07-12 12:34:47 +09:00
parent cec88d2897
commit f1a6b37e8e
1 changed files with 12 additions and 4 deletions

View File

@ -2365,11 +2365,19 @@ b64enc(const unsigned char *input, int length, char *output, int maxsize)
return 0; return 0;
} }
#elif defined(USE_ONLY_MD5) #elif defined(USE_ONLY_MD5)
base64_encodestate state; if ((((length + 2) / 3) * 4) <= maxsize)
{
base64_encodestate state;
base64_init_encodestate(&state); base64_init_encodestate(&state);
output += base64_encode_block((const char *)input, length, output, &state); output += base64_encode_block((const char *)input, length, output, &state);
base64_encode_blockend(output, &state); base64_encode_blockend(output, &state);
}
else
{
RTMP_Log(RTMP_LOGDEBUG, "%s, error", __FUNCTION__);
return 0;
}
#else /* USE_OPENSSL */ #else /* USE_OPENSSL */
BIO *bmem, *b64; BIO *bmem, *b64;