From: Pierre Ossman Date: Wed, 11 May 2022 07:16:01 +0000 (+0200) Subject: Safer allocation of icon array X-Git-Tag: v1.12.90~35^2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e65877b9fbd6112c680f518946c33194aef7edf1;p=tigervnc.git 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. --- 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;