summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-08-19 17:21:21 +0800
committeryangwei <[email protected]>2024-08-19 18:27:28 +0800
commitd467a9ad1e1e50794c53d8080f28c394d02c1d1b (patch)
tree116d580fccc9b77ff4fce6f525fac25583dd329a
parent824844b9fd593e6bf518ef934f78f50b44deb5a5 (diff)
🐞 fix(parse_packet_io_section): dumpfie_dir trimmed with toml_rtos
-rw-r--r--src/core/stellar_config.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/stellar_config.cpp b/src/core/stellar_config.cpp
index 4539dba..d5819bd 100644
--- a/src/core/stellar_config.cpp
+++ b/src/core/stellar_config.cpp
@@ -82,13 +82,15 @@ static int parse_packet_io_section(toml_table_t *root, struct packet_io_options
if (opts->mode == PACKET_IO_DUMPFILE)
{
ptr = toml_raw_in(table, "dumpfile_dir");
- if (ptr == NULL)
+ char *dir_str=NULL;
+ toml_rtos(ptr, &dir_str);
+ if (ptr == NULL || dir_str == NULL)
{
CONFIG_LOG_ERROR("config file missing packet_io->dumpfile_dir");
return -1;
}
// skip ""
- strncpy(opts->dumpfile_dir, ptr + 1, strlen(ptr) - 2);
+ strcpy(opts->dumpfile_dir, dir_str);
}
else
{