From f77959696ca074b61cff76f4f9d97106be39aaa9 Mon Sep 17 00:00:00 2001 From: Michael Aganier Date: Mon, 6 Nov 2023 00:21:11 -0500 Subject: [PATCH] Fix directive output truncated writing 4 bytes into a region of size 1. --- ubench.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ubench.h b/ubench.h index 471a9c0..ad636f5 100644 --- a/ubench.h +++ b/ubench.h @@ -387,7 +387,7 @@ UBENCH_EXTERN struct ubench_state_s ubench_state; static void ubench_##SET##_##NAME(struct ubench_run_state_s *ubs); \ UBENCH_INITIALIZER(ubench_register_##SET##_##NAME) { \ const size_t index = ubench_state.benchmarks_length++; \ - const char *name_part = #SET "." #NAME; \ + const char name_part[] = #SET "." #NAME; \ const size_t name_size = strlen(name_part) + 1; \ char *name = UBENCH_PTR_CAST(char *, malloc(name_size)); \ ubench_state.benchmarks = UBENCH_PTR_CAST( \ @@ -432,7 +432,7 @@ UBENCH_EXTERN struct ubench_state_s ubench_state; } \ UBENCH_INITIALIZER(ubench_register_##FIXTURE##_##NAME) { \ const size_t index = ubench_state.benchmarks_length++; \ - const char *name_part = #FIXTURE "." #NAME; \ + const char name_part[] = #FIXTURE "." #NAME; \ const size_t name_size = strlen(name_part) + 1; \ char *name = UBENCH_PTR_CAST(char *, malloc(name_size)); \ ubench_state.benchmarks = UBENCH_PTR_CAST( \