Skip to content

Commit

Permalink
check for invalid mailbox header length
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-comet committed Nov 29, 2022
1 parent 6a5babf commit 2ef4d15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion soem/ethercatcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ int ecx_SDOread(ecx_contextt *context, uint16 slave, uint16 index, uint8 subinde
/* slave response should be CoE, SDO response */
if ((((aSDOp->MbxHeader.mbxtype & 0x0f) == ECT_MBXT_COE) &&
((etohs(aSDOp->CANOpen) >> 12) == ECT_COES_SDORES) &&
((aSDOp->Command & 0xe0) == 0x00)))
((aSDOp->Command & 0xe0) == 0x00) &&
(etohs(aSDOp->MbxHeader.length) >= 3)))
{
/* calculate mailbox transfer size */
Framedatasize = etohs(aSDOp->MbxHeader.length) - 3;
Expand Down

0 comments on commit 2ef4d15

Please sign in to comment.