Skip to content

Commit

Permalink
Check for NULL before strcmp.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Oct 24, 2021
1 parent 7b614b3 commit 9e5b850
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ int db__message_insert(struct mosquitto *context, uint16_t mid, enum mosquitto_m
&& dir == mosq_md_out && retain == false && stored->dest_ids){

for(i=0; i<stored->dest_id_count; i++){
if(!strcmp(stored->dest_ids[i], context->id)){
if(stored->dest_ids[i] && !strcmp(stored->dest_ids[i], context->id)){
/* We have already sent this message to this client. */
mosquitto_property_free_all(&properties);
return MOSQ_ERR_SUCCESS;
Expand Down

0 comments on commit 9e5b850

Please sign in to comment.