All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_hook: Fix realloc size to avoid memory overwriting
@ 2026-06-29 11:54 Zbigniew Kempczyński
  2026-06-29 11:59 ` Knop, Ryszard
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Zbigniew Kempczyński @ 2026-06-29 11:54 UTC (permalink / raw)
  To: igt-dev; +Cc: Zbigniew Kempczyński, Gustavo Sousa, Ryszard Knop

Doubling test name size might be not enough for realloc if target name
length is larger than test/subtest name size.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: Ryszard Knop <ryszard.knop@intel.com>
---
 lib/igt_hook.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_hook.c b/lib/igt_hook.c
index b8f25b6c7a..a44b852da1 100644
--- a/lib/igt_hook.c
+++ b/lib/igt_hook.c
@@ -300,7 +300,7 @@ static void igt_hook_update_test_name_pre_call(struct igt_hook *igt_hook, struct
 	if (len + 1 > *size_ptr) {
 		size_t fullname_size;
 
-		*size_ptr *= 2;
+		*size_ptr += len + 1;
 		*name_ptr = realloc(*name_ptr, *size_ptr);
 
 		fullname_size = igt_hook_calc_test_fullname_size(igt_hook);
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-06-29 22:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 11:54 [PATCH i-g-t] lib/igt_hook: Fix realloc size to avoid memory overwriting Zbigniew Kempczyński
2026-06-29 11:59 ` Knop, Ryszard
2026-06-29 12:17 ` Gustavo Sousa
2026-06-29 15:38   ` Zbigniew Kempczyński
2026-06-29 16:32   ` Zbigniew Kempczyński
2026-06-29 22:33     ` Gustavo Sousa
2026-06-29 12:37 ` Jani Nikula
2026-06-29 12:37   ` Jani Nikula
2026-06-29 15:40     ` Zbigniew Kempczyński
2026-06-29 22:50 ` ✗ Fi.CI.BAT: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.