summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/glut/glx/glut_menu.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/glut/glx/glut_menu.c b/src/glut/glx/glut_menu.c
index 4e2cac2795..4c4a5ae750 100644
--- a/src/glut/glx/glut_menu.c
+++ b/src/glut/glx/glut_menu.c
@@ -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();
}