From b502d9dcf7e66e222776ea1b9332ab57346cb8a8 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Wed, 10 Aug 2016 14:23:27 -0600 Subject: [PATCH] help static analysis tools --- wolfcrypt/src/rsa.c | 4 ++-- wolfcrypt/test/test.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index 616bcaf37..e34e17c85 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -1186,7 +1186,7 @@ int wc_RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out, word32 outLen, XFREE(tmp, key->heap, DYNAMIC_TYPE_RSA); return plainLen; } - if (plainLen > (int)outLen) + if (plainLen > (int)outLen || pad == NULL) plainLen = BAD_FUNC_ARG; else XMEMCPY(out, pad, plainLen); @@ -1305,7 +1305,7 @@ int wc_RsaSSL_Verify(const byte* in, word32 inLen, byte* out, word32 outLen, return plainLen; } - if (plainLen > (int)outLen) + if (plainLen > (int)outLen || pad == NULL) plainLen = BAD_FUNC_ARG; else XMEMCPY(out, pad, plainLen); diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 5d2bff6c9..9296f6c55 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -3957,6 +3957,7 @@ int memory_test(void) return -113; /* should round to 0 since struct + bucket will not fit */ } + (void)dist; /* avoid static analysis warning of variable not used */ return 0; } #endif /* WOLFSSL_STATIC_MEMORY */