]> source.dussan.org Git - tigervnc.git/commitdiff
Safer allocation of icon array
authorPierre Ossman <ossman@cendio.se>
Wed, 11 May 2022 07:16:01 +0000 (09:16 +0200)
committerPierre Ossman <ossman@cendio.se>
Wed, 11 May 2022 07:16:01 +0000 (09:16 +0200)
Avoid the risk of the list of sizes and the list of icons getting out of
sync and causing memory corruption.

vncviewer/vncviewer.cxx

index 3a7319c622aeb86d90adce57f114af89b0daeead..bbc7e3720d4fad107a0144114647aa74e5538c8c 100644 (file)
@@ -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;