From 3f5b0250f45b72f715f0773954b4ef4bf552843b Mon Sep 17 00:00:00 2001 From: TapTap Date: Tue, 15 Sep 2026 23:53:49 +0200 Subject: [PATCH] fix: ASan out-of-bounds argv in cli test, cppcheck uninit rate buffer --- src/client/client_send.c | 4 ++-- tests/test_client_cli.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/client_send.c b/src/client/client_send.c index 384fb96..ae43bcb 100644 --- a/src/client/client_send.c +++ b/src/client/client_send.c @@ -96,8 +96,8 @@ static void report_transfer_stats(const Config* config, int total_files, double elapsed = difftime(time(NULL), start); double rate = elapsed > 0.0 ? (double)total_bytes / elapsed : 0.0; char total_buffer[32]; - char rate_buffer[32]; - char human_rate[32]; + char rate_buffer[32] = {0}; + char human_rate[32] = {0}; const char* total = stats_bytes(config, total_bytes, total_buffer, sizeof(total_buffer)); const char* rate_str = rate_buffer; if (config->human_readable) { diff --git a/tests/test_client_cli.c b/tests/test_client_cli.c index b2f3421..c766e9a 100644 --- a/tests/test_client_cli.c +++ b/tests/test_client_cli.c @@ -3924,7 +3924,7 @@ static void test_parse_args_attached_short_values() { cfg = valid_client_config(); positional_count = 0; char* argv_m[] = {"fastsync", "-Mfoo=bar", "--source-dir", "/src", "--dest-dir", "/dst"}; - EXPECT_EQ_INT(parse_args(cfg, 7, argv_m, positional_args, &positional_count), 0); + EXPECT_EQ_INT(parse_args(cfg, 6, argv_m, positional_args, &positional_count), 0); EXPECT_EQ_INT(cfg->remote_option_count, 1); EXPECT_EQ_STR(cfg->remote_options[0], "foo=bar"); config_delete(cfg);