Skip to contentSkip to conversation

pkcs5: Fix warning of possible uninitialized var

PATCH New Brian Gix 1 participant 1 message Jan 4, 2021

lore
Share & tools
lore

Brian Gix

author
#0 lore raw

PATCH 1/1 pkcs5: Fix warning of possible uninitialized var

ell/pkcs5.c: In function ‘pkcs12_pbkdf’:
ell/pkcs5.c:240:3: error: ‘bmpstring’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

  240 |   explicit_bzero(bmpstring, passwd_len);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 ell/pkcs5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ell/pkcs5.c +1 -1
index 25bf431..47d66ae 100644
@@ -190,7 +190,7 @@ uint8_t *pkcs12_pbkdf(const char *password, const struct pkcs12_hash *hash,
 {
 	/* All lengths in bytes instead of bits */
 	size_t passwd_len = password ? 2 * strlen(password) + 2 : 0;
-	uint8_t *bmpstring;
+	uint8_t *bmpstring = NULL;
 	/* Documented as v(ceiling(s/v)), usually will just equal v */
 	unsigned int s_len = (salt_len + hash->v - 1) & ~(hash->v - 1);
 	/* Documented as p(ceiling(s/p)), usually will just equal v */
Signature · 1 line
2.25.4