Skip to content

Commit 6bf3304

Browse files
committed
add missing length check to prevent buffer overflow
1 parent 3bf6300 commit 6bf3304

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/wh_client_crypto.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,10 @@ int wh_Client_AesGcmDma(whClientContext* ctx, Aes* aes, int enc,
12441244
req_len += req->keySz;
12451245
}
12461246

1247+
if (req_len > WOLFHSM_CFG_COMM_DATA_LEN) {
1248+
return WH_ERROR_BADARGS;
1249+
}
1250+
12471251
/* Copy request data not handled by DMA */
12481252
memcpy(req_iv, iv, iv_len);
12491253
if (enc == 0 && tag_len > 0) {

0 commit comments

Comments
 (0)