Browse Source

fixes for cppcheck uninitvar src/pk.c (false positives) and nullPointerRedundantCheck in src/ssl_load.c (true positive).

Daniel Pouzzner 2 weeks ago
parent
commit
3df11e7eab
2 changed files with 4 additions and 4 deletions
  1. 2 2
      src/pk.c
  2. 2 2
      src/ssl_load.c

+ 2 - 2
src/pk.c

@@ -16198,7 +16198,7 @@ int wolfSSL_PEM_write_bio_PKCS8PrivateKey(WOLFSSL_BIO* bio,
     int passwdSz, wc_pem_password_cb* cb, void* ctx)
 {
     byte* pem = NULL;
-    int pemSz;
+    int pemSz = 0;
     int res = 1;
 
     /* Validate parameters. */
@@ -16243,7 +16243,7 @@ int wolfSSL_PEM_write_PKCS8PrivateKey(XFILE f, WOLFSSL_EVP_PKEY* pkey,
     wc_pem_password_cb* cb, void* ctx)
 {
     byte* pem = NULL;
-    int pemSz;
+    int pemSz = 0;
     int res = 1;
 
     /* Validate parameters. */

+ 2 - 2
src/ssl_load.c

@@ -1529,7 +1529,7 @@ static void ProcessBufferCertSetHave(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
     if (ssl != NULL) {
         ssl->pkCurveOID = cert->pkCurveOID;
     }
-    else {
+    else if (ctx) {
         ctx->pkCurveOID = cert->pkCurveOID;
     }
     #endif
@@ -1540,7 +1540,7 @@ static void ProcessBufferCertSetHave(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
     if (ssl != NULL) {
         ssl->options.haveECC = ssl->options.haveECDSAsig;
     }
-    else {
+    else if (ctx) {
         ctx->haveECC = ctx->haveECDSAsig;
     }
 #endif /* !WC_STRICT_SIG */