1
0
mirror of https://github.com/eclipse/mosquitto.git synced 2025-05-09 01:01:11 +08:00

Shared subs must have a valid topic

This commit is contained in:
Roger A. Light 2024-10-16 16:25:26 +01:00
parent 71ddbabb00
commit 732b8eb584
2 changed files with 9 additions and 1 deletions

View File

@ -97,7 +97,7 @@ int sub__topic_tokenise(const char *subtopic, char **local_sub, char ***topics,
} }
if(!strcmp((*topics)[0], "$share")){ if(!strcmp((*topics)[0], "$share")){
if(count < 2){ if(count < 3 || (count == 3 && strlen((*topics)[2]) == 0)){
mosquitto__free(*local_sub); mosquitto__free(*local_sub);
mosquitto__free(*topics); mosquitto__free(*topics);
return MOSQ_ERR_PROTOCOL; return MOSQ_ERR_PROTOCOL;

View File

@ -219,6 +219,14 @@
{"type":"send", "payload":"82 0B 1234 00 0001 70 00 0001 71 00"}, {"type":"send", "payload":"82 0B 1234 00 0001 70 00 0001 71 00"},
{"type":"recv", "payload":"90 05 1234 00 00 00"} {"type":"recv", "payload":"90 05 1234 00 00 00"}
]}, ]},
{ "name": "82 shared sub with no topic part 1", "ver":5, "msgs": [
{"type":"send", "payload":"82 0F 1234 00 0009 2473686172652F702F 00"},
{"type":"recv", "payload":"E0 01 82"}
]},
{ "name": "82 shared sub with no topic part 2", "ver":5, "msgs": [
{"type":"send", "payload":"82 0E 1234 00 0008 2473686172652F70 00"},
{"type":"recv", "payload":"E0 01 82"}
]},
{ "name": "82 shared sub with no local set", "ver":5, "msgs": [ { "name": "82 shared sub with no local set", "ver":5, "msgs": [
{"type":"send", "payload":"82 10 1234 00 000A 2473686172652F702F70 04"}, {"type":"send", "payload":"82 10 1234 00 000A 2473686172652F702F70 04"},
{"type":"recv", "payload":"E0 01 82"} {"type":"recv", "payload":"E0 01 82"}