Skip to content

Commit

Permalink
Always set cipher_mode even in crypt_parse_name_and_mode.
Browse files Browse the repository at this point in the history
Othewrwise some tools like valgrind can see unitialized string.
  • Loading branch information
mbroz committed Jul 29, 2024
1 parent c658637 commit af2c32f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/utils_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ int crypt_parse_name_and_mode(const char *s, char *cipher, int *key_nums,
}

if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]", cipher) == 1) {
if (strncmp(cipher, "capi:", 5))
if (!strncmp(cipher, "capi:", 5))
strcpy(cipher_mode, "");
else
strcpy(cipher_mode, "cbc-plain");
if (key_nums)
*key_nums = 1;
Expand Down

0 comments on commit af2c32f

Please sign in to comment.