From 700359ca5a9989e08739ff1a74e4806736bce99b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 May 2006 19:21:16 +0000 Subject: [PATCH] check if button >= GLUT_MAX_MENUS in glutAttacheMenu() --- src/glut/glx/glut_menu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/glut/glx/glut_menu.c b/src/glut/glx/glut_menu.c index 4e2cac27959..4c4a5ae7503 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(); } -- 2.30.2