Fix warnings reported by static analysis.

- ensure that strings are \0 terminated (most of this is already
handled on higher level anyway)

- fix resource leak in error path in tcrypt.c

- fix time of check/time of use race in sysfs path processing

- insruct Coverity scanner to ignore constant expression in random.c
(it is intented to stop compile-time misconfiguration of RNG that would be fatal)
This commit is contained in:
Milan Broz
2016-04-24 12:07:31 +02:00
parent c2ddd48f50
commit 683e4db48b
7 changed files with 36 additions and 19 deletions

View File

@@ -234,9 +234,11 @@ void crypt_random_exit(void)
int crypt_random_default_key_rng(void)
{
/* coverity[pointless_string_compare] */
if (!strcmp(DEFAULT_RNG, RANDOM_DEVICE))
return CRYPT_RNG_RANDOM;
/* coverity[pointless_string_compare] */
if (!strcmp(DEFAULT_RNG, URANDOM_DEVICE))
return CRYPT_RNG_URANDOM;