Skip to contentSkip to conversation

cert: Fix warning of possible uninitialized var

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

lore
Share & tools
lore

Brian Gix

author
#0 lore raw

PATCH v3 1/1 cert: Fix warning of possible uninitialized var

ell/cert-crypto.c: In function ‘cert_pkcs12_pbkdf’:
ell/cert-crypto.c:244:3: error: ‘bmpstring’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

  244 |   explicit_bzero(bmpstring, passwd_len);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 ell/cert-crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ell/cert-crypto.c +1 -1
index 6eb4e14..d07fabb 100644
@@ -194,7 +194,7 @@ uint8_t *cert_pkcs12_pbkdf(const char *password,
 {
 	/* All lengths in bytes instead of bits */
 	size_t passwd_len = password ? 2 * strlen(password) + 2 : 0;
-	uint8_t *bmpstring;
+	uint8_t *uninitialized_var(bmpstring);
 	/* 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