diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2021-05-19 01:33:53 +0200 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2021-05-19 01:33:53 +0200 |
commit | 0b506e51d0f907e1f8d6a0efda6cb035f50d34ce (patch) | |
tree | 2c565ae7eaa6ef1d078c5045d25b82f38c5ba37d | |
parent | 3e52cf717ca189447862bec5635201785688dd3f (diff) | |
download | psmq-0b506e51d0f907e1f8d6a0efda6cb035f50d34ce.tar.gz psmq-0b506e51d0f907e1f8d6a0efda6cb035f50d34ce.tar.bz2 psmq-0b506e51d0f907e1f8d6a0efda6cb035f50d34ce.zip |
src/cfg.c: fix potential segfault when printing config
When program log is not set it is set to NULL, which is
passed to strlen, which can cause segfault.
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
-rw-r--r-- | src/cfg.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -243,7 +243,10 @@ void psmqd_cfg_print(void) #endif CONFIG_PRINT(log_level, "%d"); CONFIG_PRINT(colorful_output, "%d"); - CONFIG_PRINT(program_log, "%s"); + if (g_psmqd_cfg.program_log) + CONFIG_PRINT(program_log, "%s"); + else + CONFIG_PRINT(program_log, "(stderr)"); CONFIG_PRINT(broker_name, "%s"); CONFIG_PRINT(broker_maxmsg, "%d"); CONFIG_PRINT(remove_queue, "%d"); |