From bb5c17ec78b48743e9d3d0187a712598d01efe21 Mon Sep 17 00:00:00 2001 From: Yatao Li Date: Tue, 8 Feb 2022 04:24:56 +0800 Subject: [PATCH] do not log arg script if null --- src/cli.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cli.c b/src/cli.c index 8d9477f..9c4092b 100644 --- a/src/cli.c +++ b/src/cli.c @@ -374,15 +374,15 @@ int index_args_validate(index_args_t *args, int argc, const char **argv) { LOG_DEBUGF("cli.c", "arg es_index=%s", args->es_index) LOG_DEBUGF("cli.c", "arg index_path=%s", args->index_path) LOG_DEBUGF("cli.c", "arg script_path=%s", args->script_path) + LOG_DEBUGF("cli.c", "arg async_script=%d", args->async_script) - char log_buf[5000]; - strncpy(log_buf, args->script, sizeof(log_buf)); - *(log_buf + sizeof(log_buf) - 1) = '\0'; - LOG_DEBUGF("cli.c", "arg async_script=%s", log_buf) + if (args->script) { + char log_buf[5000]; - strncpy(log_buf, args->script, sizeof(log_buf)); - *(log_buf + sizeof(log_buf) - 1) = '\0'; - LOG_DEBUGF("cli.c", "arg script=%s", log_buf) + strncpy(log_buf, args->script, sizeof(log_buf)); + *(log_buf + sizeof(log_buf) - 1) = '\0'; + LOG_DEBUGF("cli.c", "arg script=%s", log_buf) + } LOG_DEBUGF("cli.c", "arg print=%d", args->print) LOG_DEBUGF("cli.c", "arg es_mappings_path=%s", args->es_mappings_path)