mirror of
https://github.com/eclipse/mosquitto.git
synced 2025-05-09 01:01:11 +08:00
Fix incorrect string length calculation.
Closes #1963. Thanks to twegener-embertec.
This commit is contained in:
parent
e97cf6252e
commit
0ec258d01f
@ -824,8 +824,7 @@ log_timestamp_format %Y-%m-%dT%H:%M:%S
|
|||||||
<term><option>persistence_location</option> <replaceable>path</replaceable></term>
|
<term><option>persistence_location</option> <replaceable>path</replaceable></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>The path where the persistence database should be
|
<para>The path where the persistence database should be
|
||||||
stored. Must end in a trailing slash. If not given,
|
stored. If not given, then the current directory is used.</para>
|
||||||
then the current directory is used.</para>
|
|
||||||
|
|
||||||
<para>This option applies globally.</para>
|
<para>This option applies globally.</para>
|
||||||
|
|
||||||
|
@ -412,9 +412,9 @@
|
|||||||
# the path.
|
# the path.
|
||||||
#persistence_file mosquitto.db
|
#persistence_file mosquitto.db
|
||||||
|
|
||||||
# Location for persistent database. Must include trailing /
|
# Location for persistent database.
|
||||||
# Default is an empty string (current directory).
|
# Default is an empty string (current directory).
|
||||||
# Set to e.g. /var/lib/mosquitto/ if running as a proper service on Linux or
|
# Set to e.g. /var/lib/mosquitto if running as a proper service on Linux or
|
||||||
# similar.
|
# similar.
|
||||||
#persistence_location
|
#persistence_location
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ int config__read(struct mosquitto__config *config, bool reload)
|
|||||||
}
|
}
|
||||||
mosquitto__free(config->persistence_filepath);
|
mosquitto__free(config->persistence_filepath);
|
||||||
if(config->persistence_location && strlen(config->persistence_location)){
|
if(config->persistence_location && strlen(config->persistence_location)){
|
||||||
len = strlen(config->persistence_location) + strlen(config->persistence_file) + 1;
|
len = strlen(config->persistence_location) + strlen(config->persistence_file) + 2;
|
||||||
config->persistence_filepath = mosquitto__malloc(len);
|
config->persistence_filepath = mosquitto__malloc(len);
|
||||||
if(!config->persistence_filepath) return MOSQ_ERR_NOMEM;
|
if(!config->persistence_filepath) return MOSQ_ERR_NOMEM;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
Loading…
x
Reference in New Issue
Block a user