From 2e0798e0641f91b121a49ed9d636b6fade8afb78 Mon Sep 17 00:00:00 2001 From: Patrick Mackinlay Date: Wed, 1 Feb 2023 13:30:24 +0700 Subject: font_sdl: better fix for variable-length array --- src/osd/modules/font/font_sdl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/modules/font/font_sdl.cpp b/src/osd/modules/font/font_sdl.cpp index 6ad3ceff159..1938c97a44d 100644 --- a/src/osd/modules/font/font_sdl.cpp +++ b/src/osd/modules/font/font_sdl.cpp @@ -199,7 +199,7 @@ osd_font_sdl::TTF_Font_ptr osd_font_sdl::TTF_OpenFont_Magic(std::string const &n unsigned char const ttf_magic[] = { 0x00, 0x01, 0x00, 0x00, 0x00 }; unsigned char const ttc1_magic[] = { 0x74, 0x74, 0x63, 0x66, 0x00, 0x01, 0x00, 0x00 }; unsigned char const ttc2_magic[] = { 0x74, 0x74, 0x63, 0x66, 0x00, 0x02, 0x00, 0x00 }; - unsigned char buffer[8]; + unsigned char buffer[std::max({ sizeof(ttf_magic), sizeof(ttc1_magic), sizeof(ttc2_magic) })]; auto const bytes_read = file.read(buffer, std::size(buffer)); file.close(); -- cgit v1.2.3