Skip to content

Commit

Permalink
Protect get packet ID
Browse files Browse the repository at this point in the history
  • Loading branch information
AniruddhaKanhere committed Sep 13, 2022
1 parent ea62cdf commit 0e7df2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/core_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -3032,6 +3032,7 @@ uint16_t MQTT_GetPacketId( MQTTContext_t * pContext )

if( pContext != NULL )
{
MQTT_PRE_STATE_UPDATE_HOOK( pContext );
packetId = pContext->nextPacketId;

/* A packet ID of zero is not a valid packet ID. When the max ID
Expand All @@ -3044,6 +3045,7 @@ uint16_t MQTT_GetPacketId( MQTTContext_t * pContext )
{
pContext->nextPacketId++;
}
MQTT_POST_STATE_UPDATE_HOOK( pContext );
}

return packetId;
Expand Down

0 comments on commit 0e7df2e

Please sign in to comment.