Skip to content

Commit 0a082b0

Browse files
Code review feedback
1 parent 42b321a commit 0a082b0

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

wolfcrypt/src/hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,7 @@ int _wc_Hash_Grow(byte** msg, word32* used, word32* len, const byte* in,
19561956
{
19571957
word32 usedSz = 0;
19581958

1959-
if (!WC_SAFE_SUM_WORD32(*used, (word32)inSz, usedSz))
1959+
if (inSz <= 0 || !WC_SAFE_SUM_WORD32(*used, (word32)inSz, usedSz))
19601960
return BAD_FUNC_ARG;
19611961

19621962
if (*len < usedSz) {

wolfcrypt/src/port/nxp/se050_port.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ int se050_hash_update(SE050_HASH_Context* se050Ctx, const byte* data, word32 len
278278
if (se050Ctx->msg == NULL) {
279279
se050Ctx->msg = (byte*)XMALLOC(usedSz,
280280
se050Ctx->heap, DYNAMIC_TYPE_TMP_BUFFER);
281+
if (se050Ctx->msg == NULL) {
282+
return MEMORY_E;
283+
}
281284
XMEMSET(se050Ctx->msg, 0, usedSz);
282285
}
283286
else {

0 commit comments

Comments
 (0)