Skip to content

Commit

Permalink
Merge pull request #128 from EmilioPeJu/fix-size-check
Browse files Browse the repository at this point in the history
Fix size checks
  • Loading branch information
augustofg authored Nov 10, 2022
2 parents f32c3d5 + c0c3439 commit eddf4fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/fru.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ IPMI_HANDLER(ipmi_storage_read_fru_data_cmd, NETFN_STORAGE, IPMI_READ_FRU_DATA_C
/* Count byte on the request is "1" based */
uint8_t count = req->data[3];

if ( (count-1) > IPMI_MSG_MAX_LENGTH ) {
/* Consider header, count, data and checksum */
if ( (count + IPMB_RESP_HEADER_LENGTH + 2) > IPMI_MSG_MAX_LENGTH ) {
rsp->completion_code = IPMI_CC_CANT_RET_NUM_REQ_BYTES;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/ipmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void IPMB_RXTask ( void *pvParameters )

for ( ;; ) {
/* Checks if there's any incoming messages (the task remains blocked here) */
rx_len = xI2CSlaveReceive( IPMB_I2C, &ipmb_buffer_rx[1], (sizeof(ipmb_buffer_rx)/sizeof(ipmb_buffer_rx[0])), portMAX_DELAY );
rx_len = xI2CSlaveReceive( IPMB_I2C, &ipmb_buffer_rx[1], IPMI_MSG_MAX_LENGTH - 1, portMAX_DELAY );

if ( rx_len > 0 ) {

Expand Down

0 comments on commit eddf4fb

Please sign in to comment.