From e65877b9fbd6112c680f518946c33194aef7edf1 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 11 May 2022 09:16:01 +0200 Subject: [PATCH] Safer allocation of icon array Avoid the risk of the list of sizes and the list of icons getting out of sync and causing memory corruption. --- vncviewer/vncviewer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index 3a7319c6..bbc7e372 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -357,7 +357,7 @@ static void init_fltk() #elif ! defined(__APPLE__) const int icon_sizes[] = {48, 32, 24, 16}; - Fl_PNG_Image *icons[4]; + Fl_PNG_Image *icons[sizeof(icon_sizes)/sizeof(icon_sizes[0])]; int count; count = 0; -- 2.39.5