diff options
author | Archit Aggarwal <architag@amazon.com> | 2020-07-21 17:01:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-21 17:01:00 -0700 |
commit | fce6ec479dfb24688cfd9b7644ef17a1367833b7 (patch) | |
tree | da4219cbfb4085bbf41bd29b10cd834c5ca21350 | |
parent | 274a6c331d904be287be0cf9d9a0efafafa1fddc (diff) | |
download | freertos-git-fce6ec479dfb24688cfd9b7644ef17a1367833b7.tar.gz |
Port CBMC recognized undefined behavior fixes from C-SDK v4_beta (#157)
2 files changed, 14 insertions, 6 deletions
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta1/c_sdk/standard/mqtt/src/iot_mqtt_subscription.c b/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta1/c_sdk/standard/mqtt/src/iot_mqtt_subscription.c index 37b6c6384..831955396 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta1/c_sdk/standard/mqtt/src/iot_mqtt_subscription.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta1/c_sdk/standard/mqtt/src/iot_mqtt_subscription.c @@ -668,11 +668,18 @@ bool IotMqtt_IsSubscribed( IotMqttConnection_t mqttConnection, * function is running. */ IotMutex_Lock( &( mqttConnection->subscriptionMutex ) ); - /* Search for a matching subscription. */ - pSubscriptionLink = IotListDouble_FindFirstMatch( &( mqttConnection->subscriptionList ), - NULL, - _topicMatch, - &topicMatchParams ); + if( pTopicFilter == NULL ) + { + IotLogError( "Topic filter must be set." ); + } + else + { + /* Search for a matching subscription. */ + pSubscriptionLink = IotListDouble_FindFirstMatch( &( mqttConnection->subscriptionList ), + NULL, + _topicMatch, + &topicMatchParams ); + } /* Check if a matching subscription was found. */ if( pSubscriptionLink != NULL ) diff --git a/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta1/c_sdk/standard/mqtt/src/iot_mqtt_validate.c b/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta1/c_sdk/standard/mqtt/src/iot_mqtt_validate.c index cdcca62f0..950d99297 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta1/c_sdk/standard/mqtt/src/iot_mqtt_validate.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta1/c_sdk/standard/mqtt/src/iot_mqtt_validate.c @@ -619,7 +619,8 @@ bool _IotMqtt_ValidateConnect( const IotMqttConnectInfo_t * pConnectInfo ) /* If will info is provided, check that it is valid. */ if( pConnectInfo->pWillInfo != NULL ) { - status = _IotMqtt_ValidateLwtPublish( pConnectInfo->awsIotMqttMode, + status = ( pConnectInfo->pWillInfo->pPayload != NULL ) && + _IotMqtt_ValidateLwtPublish( pConnectInfo->awsIotMqttMode, pConnectInfo->pWillInfo ); } } |