mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
vircryptotest: Directly assign string to avoid memcpy
Found by clang-tidy's "bugprone-not-null-terminated-result" check. clang-tidy's finding is a false positive in this case, as the memset call guarantees null termination. The assignment can be simplified though, and this happens to silence the warning. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
b62e51e540
commit
ae9f4d5e0c
@ -122,7 +122,7 @@ static int
|
|||||||
mymain(void)
|
mymain(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint8_t secretdata[8];
|
uint8_t secretdata[8] = "letmein";
|
||||||
uint8_t expected_ciphertext[16] = {0x48, 0x8e, 0x9, 0xb9,
|
uint8_t expected_ciphertext[16] = {0x48, 0x8e, 0x9, 0xb9,
|
||||||
0x6a, 0xa6, 0x24, 0x5f,
|
0x6a, 0xa6, 0x24, 0x5f,
|
||||||
0x1b, 0x8c, 0x3f, 0x48,
|
0x1b, 0x8c, 0x3f, 0x48,
|
||||||
@ -166,9 +166,6 @@ mymain(void)
|
|||||||
ret = -1; \
|
ret = -1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
memset(&secretdata, 0, 8);
|
|
||||||
memcpy(&secretdata, "letmein", 7);
|
|
||||||
|
|
||||||
VIR_CRYPTO_ENCRYPT(VIR_CRYPTO_CIPHER_AES256CBC, "aes265cbc",
|
VIR_CRYPTO_ENCRYPT(VIR_CRYPTO_CIPHER_AES256CBC, "aes265cbc",
|
||||||
secretdata, 7, expected_ciphertext, 16);
|
secretdata, 7, expected_ciphertext, 16);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user