Fix segfault in dynamic bridge support

Signed-off-by: Chris Elston <chris.elston@sancloud.com>

Sending an empty packet to $BRIDGE/new would cause a segfault because
the payload pointer was accessed without checking for NULL.

This change rejects an empty payload with MOSQ_ERR_INVAL.
pull/2318/head
Chris Elston 4 years ago
parent cd3b588601
commit 8491fd4a0c

@ -418,6 +418,8 @@ int bridge__dynamic_parse_payload_new(struct mosquitto_db *db, void* payload, st
int len;
int nb_param = 0;
if(!payload) return MOSQ_ERR_INVAL;
buf = strtok(payload, "\n");
while(buf) {

Loading…
Cancel
Save