check if button >= GLUT_MAX_MENUS in glutAttacheMenu()
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 10 May 2006 19:21:16 +0000 (19:21 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 10 May 2006 19:21:16 +0000 (19:21 +0000)
src/glut/glx/glut_menu.c

index 4e2cac279594e85059d2ae03833e7493aaa09d1e..4c4a5ae7503e4f8ea6ed82e17cd1c76a5a0a6f8a 100644 (file)
@@ -1000,6 +1000,10 @@ glutAddSubMenu(const char *label, int menu)
 void GLUTAPIENTRY 
 glutAttachMenu(int button)
 {
+  /* if button >= GLUT_MAX_MENUS, we'll go out of array bounds below */
+  if (button >= GLUT_MAX_MENUS) {
+    return;
+  }
   if (__glutMappedMenu) {
     __glutMenuModificationError();
   }