Skip to content

Commit

Permalink
Initialize output-only variables to help the memory sanitizer.
Browse files Browse the repository at this point in the history
  • Loading branch information
0-wiz-0 committed Sep 29, 2023
1 parent 2865c74 commit 9e03af3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/zip_crypto_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ _zip_crypto_aes_free(_zip_crypto_aes_t *aes) {

bool
_zip_crypto_aes_encrypt_block(_zip_crypto_aes_t *aes, const zip_uint8_t *in, zip_uint8_t *out) {
int len;
int len = 0;
if (EVP_EncryptUpdate(aes, out, &len, in, ZIP_CRYPTO_AES_BLOCK_LENGTH) != 1
|| len != ZIP_CRYPTO_AES_BLOCK_LENGTH) {
return false;
Expand Down Expand Up @@ -215,10 +215,10 @@ _zip_crypto_hmac_free(_zip_crypto_hmac_t *hmac) {
bool
_zip_crypto_hmac_output(_zip_crypto_hmac_t *hmac, zip_uint8_t *data) {
#ifdef USE_OPENSSL_3_API
size_t length;
size_t length = 0;
return EVP_MAC_final(hmac->ctx, data, &length, ZIP_CRYPTO_SHA1_LENGTH) == 1 && length == ZIP_CRYPTO_SHA1_LENGTH;
#else
unsigned int length;
unsigned int length = 0;
return HMAC_Final(hmac, data, &length) == 1 && length == ZIP_CRYPTO_SHA1_LENGTH;
#endif
}
Expand Down

0 comments on commit 9e03af3

Please sign in to comment.