]> granicus.if.org Git - transmission/commitdiff
#4400, #5462: Do not assert on input to SHA1 or RC4 if input length is 0.
authorMike Gelfand <mikedld@mikedld.com>
Thu, 4 Dec 2014 18:20:46 +0000 (18:20 +0000)
committerMike Gelfand <mikedld@mikedld.com>
Thu, 4 Dec 2014 18:20:46 +0000 (18:20 +0000)
libtransmission/crypto-utils-openssl.c

index e054ec4958a7f14a2b7e22d34e99028669fa9373..0270b17b3b11636221e5366bd13671ed591c5ebd 100644 (file)
@@ -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);