From 477bb12c0e67ab7d67c5c8dd029b815060554712 Mon Sep 17 00:00:00 2001 From: Minh Quang Luu <50074497+minminlittleshrimp@users.noreply.github.com> Date: Fri, 20 Sep 2024 01:55:58 +0700 Subject: [PATCH] Fix code scanning alert #23: Incorrect return-value check for a 'scanf'-like function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/shared/dlt_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c index d6f39058..06c9bd5c 100644 --- a/src/shared/dlt_common.c +++ b/src/shared/dlt_common.c @@ -3785,7 +3785,7 @@ void dlt_check_envvar() if (env_log_level_str != NULL) { int level = 0; - if (sscanf(env_log_level_str, "%d", &level)) + if (sscanf(env_log_level_str, "%d", &level) == 1) dlt_log_set_level(level); } @@ -3794,7 +3794,7 @@ void dlt_check_envvar() if (env_log_mode != NULL) { int mode = 0; - if (sscanf(env_log_mode, "%d", &mode)) + if (sscanf(env_log_mode, "%d", &mode) == 1) dlt_log_init(mode); }