From 28404350c4ad0f668dad205a2d9cbe9b92b3d5fc Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 8 Mar 2015 21:00:15 +0000 Subject: [PATCH] Fix possible crash when using pattern ACLs. --- ChangeLog.txt | 4 ++++ src/mosquitto_broker.h | 2 +- src/security_default.c | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index d765b0c1..10fdeaa4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +Broker: +- Fix possible crash when using pattern ACLs. + + 1.4 - 20150218 ============== diff --git a/src/mosquitto_broker.h b/src/mosquitto_broker.h index 333c1f23..d1deb7d5 100644 --- a/src/mosquitto_broker.h +++ b/src/mosquitto_broker.h @@ -102,7 +102,7 @@ struct mqtt3_config { bool log_timestamp; char *log_file; FILE *log_fptr; - int message_size_limit; + uint32_t message_size_limit; char *password_file; bool persistence; char *persistence_location; diff --git a/src/security_default.c b/src/security_default.c index daed009d..22f98fff 100644 --- a/src/security_default.c +++ b/src/security_default.c @@ -136,6 +136,8 @@ int _add_acl(struct mosquitto_db *db, const char *user, const char *topic, int a acl->access = access; acl->topic = local_topic; acl->next = NULL; + acl->ccount = 0; + acl->ucount = 0; /* Add acl to user acl list */ if(acl_user->acl){ @@ -196,7 +198,7 @@ int _add_acl_pattern(struct mosquitto_db *db, const char *topic, int access) } } - acl->ccount = 0; + acl->ucount = 0; s = local_topic; while(s){ s = strstr(s, "%u");