提交 47ae6dd0 编写于 作者: R Roger A. Light

Fix `mosquitto_passwd -U` backup file creation.

Closes #2873.
上级 bfb373d7
......@@ -5,6 +5,9 @@ Broker:
- Fix `max_queued_message 0` stopping clients from receiving messages.
Closes #2879.
Apps:
- Fix `mosquitto_passwd -U` backup file creation. Closes #2873.
2.0.16 - 2023-08-16
===================
......
......@@ -629,13 +629,14 @@ int main(int argc, char *argv[])
return 1;
}
backup_file = malloc((size_t)strlen(password_file)+strlen(".backup.XXXXXX"));
size_t len = strlen(password_file) + strlen(".backup.XXXXXX") + 1;
backup_file = malloc(len);
if(!backup_file){
fprintf(stderr, "Error: Out of memory.\n");
free(password_file);
return 1;
}
snprintf(backup_file, strlen(password_file)+5, "%s.backup.XXXXXX", password_file);
snprintf(backup_file, len, "%s.backup.XXXXXX", password_file);
free(password_file);
password_file = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册