mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Fixed memory leak. Added assert.
This commit is contained in:
parent
285a4d9ce2
commit
5713ee5fc3
@ -666,10 +666,13 @@ int lanplus_encrypt_payload(unsigned char crypt_alg,
|
||||
|
||||
/* Currently, we only support AES */
|
||||
assert(crypt_alg == IPMI_CRYPT_AES_CBC_128);
|
||||
assert(input_length <= 255);
|
||||
|
||||
|
||||
/*
|
||||
* The input to the AES encryption algorithm has to be a multiple of the block
|
||||
* size (16 bytes). The extra byte we are adding is the pad length byte.
|
||||
* The input to the AES encryption algorithm has to be a multiple of the
|
||||
* block size (16 bytes). The extra byte we are adding is the pad length
|
||||
* byte.
|
||||
*/
|
||||
mod = (input_length + 1) % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE;
|
||||
if (mod)
|
||||
@ -709,6 +712,8 @@ int lanplus_encrypt_payload(unsigned char crypt_alg,
|
||||
IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE + /* IV */
|
||||
bytes_encrypted;
|
||||
|
||||
free(padded_input);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user