From 8fd20110c591e86819519d5bbed457831c4e16d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:47:18 +0000 Subject: [PATCH 1/4] Initial plan From 8b80bbb078d7d1698e64d6bd3172053f8b9078c3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:50:26 +0000 Subject: [PATCH 2/4] Replace magic number with MAX_REPLACEMENT_LENGTH constant Co-authored-by: Nikoro <12560977+Nikoro@users.noreply.github.com> --- linux/system_date_time_format_plugin.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux/system_date_time_format_plugin.cc b/linux/system_date_time_format_plugin.cc index 3206544..b81f59b 100644 --- a/linux/system_date_time_format_plugin.cc +++ b/linux/system_date_time_format_plugin.cc @@ -89,9 +89,10 @@ char* format_time(const char* time) { char* formatted_time = (char*)malloc(BUFFER_LENGTH); if (!formatted_time) return nullptr; + const int MAX_REPLACEMENT_LENGTH = 10; // "hh:mm:ss a" is the longest int pos = 0; int i = 0; - while (time[i] != '\0' && pos < BUFFER_LENGTH - 15) { + while (time[i] != '\0' && pos < BUFFER_LENGTH - MAX_REPLACEMENT_LENGTH - 1) { if (time[i] == '%' && time[i + 1] != '\0') { char specifier = time[i + 1]; const char* replacement = nullptr; From 64be6c39e8227a5f898ffdb18d66e442833d5722 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:52:29 +0000 Subject: [PATCH 3/4] Complete feedback implementation Co-authored-by: Nikoro <12560977+Nikoro@users.noreply.github.com> --- _codeql_detected_source_root | 1 + 1 file changed, 1 insertion(+) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file From 1eeb40ec55c895ca11c0acdece4c8d6ad7ea9499 Mon Sep 17 00:00:00 2001 From: Dominik Krajcer Date: Mon, 24 Nov 2025 20:58:00 +0100 Subject: [PATCH 4/4] Update linux/system_date_time_format_plugin.cc Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- linux/system_date_time_format_plugin.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/system_date_time_format_plugin.cc b/linux/system_date_time_format_plugin.cc index b81f59b..94a907e 100644 --- a/linux/system_date_time_format_plugin.cc +++ b/linux/system_date_time_format_plugin.cc @@ -92,7 +92,7 @@ char* format_time(const char* time) { const int MAX_REPLACEMENT_LENGTH = 10; // "hh:mm:ss a" is the longest int pos = 0; int i = 0; - while (time[i] != '\0' && pos < BUFFER_LENGTH - MAX_REPLACEMENT_LENGTH - 1) { + while (time[i] != '\0' && pos < BUFFER_LENGTH - MAX_REPLACEMENT_LENGTH) { if (time[i] == '%' && time[i + 1] != '\0') { char specifier = time[i + 1]; const char* replacement = nullptr;