mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-06 09:35:06 -05:00
getdate+nts+rtc: avoid some coverity false positives
Modify the code to avoid making the following calls incorrectly reported as important findings by the coverity static analyzer: - memset() of size 0 at the end of an array - mktime() on a struct tm that has uninitialized tm_yday
This commit is contained in:
@@ -536,7 +536,8 @@ generate_key(int index)
|
||||
BRIEF_ASSERT(key_length <= sizeof (key->key));
|
||||
|
||||
UTI_GetRandomBytesUrandom(key->key, key_length);
|
||||
memset(key->key + key_length, 0, sizeof (key->key) - key_length);
|
||||
if (key_length < sizeof (key->key))
|
||||
memset(key->key + key_length, 0, sizeof (key->key) - key_length);
|
||||
UTI_GetRandomBytes(&key->id, sizeof (key->id));
|
||||
|
||||
/* Encode the index in the lowest bits of the ID */
|
||||
|
||||
Reference in New Issue
Block a user