Skip to content

Commit 3c245ef

Browse files
committed
fix: support zero-length clientId
1 parent f6bc74b commit 3c245ef

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

source/core_mqtt_serializer.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,12 +1706,7 @@ MQTTStatus_t MQTT_GetConnectPacketSize( const MQTTConnectInfo_t * pConnectInfo,
17061706
( void * ) pPacketSize ) );
17071707
status = MQTTBadParameter;
17081708
}
1709-
else if( pConnectInfo->pClientIdentifier == NULL )
1710-
{
1711-
LogError( ( "Mqtt_GetConnectPacketSize() client identifier must be set." ) );
1712-
status = MQTTBadParameter;
1713-
}
1714-
else if( ( pConnectInfo->clientIdentifierLength == 0U ) && ( pConnectInfo->cleanSession == false ) )
1709+
else if( ( ( pConnectInfo->clientIdentifierLength == 0U ) || ( pConnectInfo->pClientIdentifier == NULL ) ) && ( pConnectInfo->cleanSession == false ) )
17151710
{
17161711
LogError( ( "Zero-length client identifier requires cleanSession=true per MQTT 3.1.1." ) );
17171712
status = MQTTBadParameter;

0 commit comments

Comments
 (0)