Skip to content

fix: warning outside array bounds #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions src/utility/STM32Cube_FW/shci.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ uint8_t SHCI_C2_FUS_GetState( SHCI_FUS_GetState_ErrorCode_t *p_error_code )
/**
* A command status event + payload has the same size than the expected command complete
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -66,7 +66,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_FwUpgrade( uint32_t fw_src_add, uint32_t fw_dest_a
* TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
uint32_t *p_cmd;
uint8_t cmd_length;
Expand Down Expand Up @@ -101,7 +101,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_FwDelete( void )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -119,7 +119,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_UpdateAuthKey( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -137,7 +137,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LockAuthKey( void )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -155,7 +155,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_StoreUsrKey( SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t *p
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
uint8_t local_payload_len;

Expand Down Expand Up @@ -189,7 +189,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LoadUsrKey( uint8_t key_index )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -209,7 +209,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_StartWs( void )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -227,7 +227,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LockUsrKey( uint8_t key_index )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -247,7 +247,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_UnloadUsrKey( uint8_t key_index )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -267,7 +267,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_ActivateAntiRollback( void )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -285,7 +285,7 @@ SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -303,7 +303,7 @@ SHCI_CmdStatus_t SHCI_C2_THREAD_Init( void )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -321,7 +321,7 @@ SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -339,7 +339,7 @@ SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -357,7 +357,7 @@ SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -375,7 +375,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseActivity( SHCI_EraseActivity_t erase_activit
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -395,7 +395,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_SetMode( SHCI_C2_CONCURRENT_Mode_Param_t Mod
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -415,7 +415,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_GetNextBleEvtTime( SHCI_C2_CONCURRENT_GetNex
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE+4];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -435,7 +435,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_EnableNext_802154_EvtNotification( void )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -453,7 +453,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_StoreData( SHCI_C2_FLASH_Ip_t Ip )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -473,7 +473,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseData( SHCI_C2_FLASH_Ip_t Ip )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -493,7 +493,7 @@ SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t Fla
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -514,7 +514,7 @@ SHCI_CmdStatus_t SHCI_C2_Reinit( void )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -533,7 +533,7 @@ SHCI_CmdStatus_t SHCI_C2_ExtpaConfig(uint32_t gpio_port, uint16_t gpio_pin_numbe
* TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -557,7 +557,7 @@ SHCI_CmdStatus_t SHCI_C2_SetFlashActivityControl(SHCI_C2_SET_FLASH_ACTIVITY_CONT
* TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 1 byte of command parameter
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -577,7 +577,7 @@ SHCI_CmdStatus_t SHCI_C2_Config(SHCI_C2_CONFIG_Cmd_Param_t *pCmdPacket)
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand All @@ -595,7 +595,7 @@ SHCI_CmdStatus_t SHCI_C2_802_15_4_DeInit( void )
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;

p_rsp = (TL_EvtPacket_t *)local_buffer;
Expand Down
3 changes: 3 additions & 0 deletions src/utility/STM32Cube_FW/tl.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ extern "C" {
#define TL_BLEEVT_CS_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t))
#define TL_BLEEVT_CS_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CS_PACKET_SIZE)

#define TL_BLEEVT_CC_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CcEvt_t))
#define TL_BLEEVT_CC_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CC_PACKET_SIZE)

/* Exported types ------------------------------------------------------------*/
/**< Packet header */
typedef PACKED_STRUCT
Expand Down