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 bdf57ad
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 bdf57ad

Please sign in to comment.