From 9061b80dee2bfe64f8c0f8dd964288acf3e51d09 Mon Sep 17 00:00:00 2001 From: Shane Utt Date: Wed, 31 Aug 2022 00:20:31 -0400 Subject: [PATCH] fix: broken F_BunnyScroll due to uninitialized buffer --- doomclassic/doom/f_finale.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doomclassic/doom/f_finale.cpp b/doomclassic/doom/f_finale.cpp index 65df744786..d311debc92 100644 --- a/doomclassic/doom/f_finale.cpp +++ b/doomclassic/doom/f_finale.cpp @@ -725,7 +725,8 @@ void F_BunnyScroll (void) int x; patch_t* p1; patch_t* p2; - char name[10]; + size_t name_len = 10; + char name[name_len]; int stage; p1 = (patch_t*)W_CacheLumpName ("PFUB2", PU_LEVEL_SHARED); @@ -765,8 +766,8 @@ void F_BunnyScroll (void) S_StartSound (NULL, sfx_pistol); ::g->laststage = stage; } - - snprintf (name, strlen(name), "END%i",stage); + + snprintf(name, name_len, "END%i", stage); V_DrawPatch ((ORIGINAL_WIDTH-13*8)/2, (ORIGINAL_HEIGHT-8*8)/2,0, (patch_t*)W_CacheLumpName (name,PU_CACHE_SHARED)); }