fix scanbuild issues, internal.c and tfm.c

This commit is contained in:
Chris Conlon
2017-12-20 12:18:49 -07:00
parent f93ed32cb3
commit e97f8b5a9c
2 changed files with 8 additions and 3 deletions

View File

@ -6022,6 +6022,9 @@ static void AddHandShakeHeader(byte* output, word32 length,
/* handshake header */ /* handshake header */
hs = (HandShakeHeader*)output; hs = (HandShakeHeader*)output;
if (hs == NULL)
return;
hs->type = type; hs->type = type;
c32to24(length, hs->length); /* type and length same for each */ c32to24(length, hs->length); /* type and length same for each */
#ifdef WOLFSSL_DTLS #ifdef WOLFSSL_DTLS
@ -14098,6 +14101,8 @@ int SendAlert(WOLFSSL* ssl, int severity, int type)
/* get output buffer */ /* get output buffer */
output = ssl->buffers.outputBuffer.buffer + output = ssl->buffers.outputBuffer.buffer +
ssl->buffers.outputBuffer.length; ssl->buffers.outputBuffer.length;
if (output == NULL)
return BUFFER_E;
input[0] = (byte)severity; input[0] = (byte)severity;
input[1] = (byte)type; input[1] = (byte)type;

View File

@ -2915,9 +2915,9 @@ int fp_isprime_ex(fp_int *a, int t)
/* do trial division */ /* do trial division */
for (r = 0; r < FP_PRIME_SIZE; r++) { for (r = 0; r < FP_PRIME_SIZE; r++) {
fp_mod_d(a, primes[r], &d); res = fp_mod_d(a, primes[r], &d);
if (d == 0) { if (res != MP_OKAY || d == 0) {
return FP_NO; return FP_NO;
} }
} }