From: Mike Gelfand Date: Thu, 4 Dec 2014 18:20:46 +0000 (+0000) Subject: #4400, #5462: Do not assert on input to SHA1 or RC4 if input length is 0. X-Git-Tag: 2.90~335 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e23390fa29bd0ff4e9b430317648891200d7d6a;p=transmission #4400, #5462: Do not assert on input to SHA1 or RC4 if input length is 0. --- diff --git a/libtransmission/crypto-utils-openssl.c b/libtransmission/crypto-utils-openssl.c index e054ec495..0270b17b3 100644 --- a/libtransmission/crypto-utils-openssl.c +++ b/libtransmission/crypto-utils-openssl.c @@ -102,6 +102,10 @@ tr_sha1_update (tr_sha1_ctx_t handle, size_t data_length) { assert (handle != NULL); + + if (data_length == 0) + return true; + assert (data != NULL); return check_result (EVP_DigestUpdate (handle, data, data_length)); @@ -175,6 +179,10 @@ tr_rc4_process (tr_rc4_ctx_t handle, int output_length; assert (handle != NULL); + + if (length == 0) + return; + assert (input != NULL); assert (output != NULL);