From f7aeab7084423a55c0206934d66c05d184143360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Thu, 22 Apr 2021 01:43:18 +0300 Subject: [PATCH] [FL-1188] cli_print_version: fix garbage dereference and function signature --- applications/cli/cli.c | 7 ++----- applications/cli/cli_commands.c | 6 +++++- applications/cli/cli_i.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/applications/cli/cli.c b/applications/cli/cli.c index a036d46c..b87404ce 100644 --- a/applications/cli/cli.c +++ b/applications/cli/cli.c @@ -71,16 +71,13 @@ void cli_print_version(const Version* version) { } void cli_motd() { - const Version* version; printf("Flipper cli.\r\n"); - version = (const Version*)api_hal_version_get_boot_version(); printf("Bootloader\r\n"); - cli_print_version(version); + cli_print_version(api_hal_version_get_boot_version()); - version = (const Version*)api_hal_version_get_fw_version(); printf("Firmware\r\n"); - cli_print_version(version); + cli_print_version(api_hal_version_get_fw_version()); } void cli_nl() { diff --git a/applications/cli/cli_commands.c b/applications/cli/cli_commands.c index a9a32518..38e544fa 100644 --- a/applications/cli/cli_commands.c +++ b/applications/cli/cli_commands.c @@ -29,7 +29,11 @@ void cli_command_help(string_t args, void* context) { void cli_command_version(string_t args, void* context) { (void)args; (void)context; - cli_print_version(); + printf("Bootloader\r\n"); + cli_print_version(api_hal_version_get_boot_version()); + + printf("Firmware\r\n"); + cli_print_version(api_hal_version_get_fw_version()); } void cli_command_uuid(string_t args, void* context) { diff --git a/applications/cli/cli_i.h b/applications/cli/cli_i.h index da8b49d4..578131e8 100644 --- a/applications/cli/cli_i.h +++ b/applications/cli/cli_i.h @@ -39,6 +39,6 @@ struct Cli { Cli* cli_alloc(); void cli_free(Cli* cli); void cli_reset_state(Cli* cli); -void cli_print_version(); +void cli_print_version(const Version* version); void cli_putc(char c); void cli_stdout_callback(void* _cookie, const char* data, size_t size);