Skip to content

Commit

Permalink
Fix messages to $ prefixed topics being rejected.
Browse files Browse the repository at this point in the history
Closes #2111. Thanks to yellowgg2.
  • Loading branch information
ralight committed Mar 6, 2021
1 parent 7baca42 commit f89a3c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog.txt
Expand Up @@ -4,6 +4,7 @@
Broker:
- Fix `tls_version` behaviour not matching documentation. It was setting the
exact TLS version to use, not the minimium TLS version to use. Closes #2110.
- Fix messages to `$` prefixed topics being rejected. Closes #2111.


2.0.8 - 2021-02-25
Expand Down
5 changes: 4 additions & 1 deletion src/retain.c
Expand Up @@ -83,7 +83,10 @@ int retain__store(const char *topic, struct mosquitto_msg_store *stored, char **
assert(split_topics);

HASH_FIND(hh, db.retains, split_topics[0], strlen(split_topics[0]), retainhier);
if(retainhier == NULL) return MOSQ_ERR_NOT_FOUND;
if(retainhier == NULL){
retainhier = retain__add_hier_entry(NULL, &db.retains, split_topics[0], (uint16_t)strlen(split_topics[0]));
if(!retainhier) return MOSQ_ERR_NOMEM;
}

for(i=0; split_topics[i] != NULL; i++){
slen = strlen(split_topics[i]);
Expand Down

0 comments on commit f89a3c3

Please sign in to comment.