From 618759f39044d9e756abaf094c7f5c85c57f3ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Sat, 9 Oct 2004 09:32:56 +0000 Subject: [PATCH] Menu items boundary checking... --- plugins/menufront.sma | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/menufront.sma b/plugins/menufront.sma index 9ccf614d..81288baf 100755 --- a/plugins/menufront.sma +++ b/plugins/menufront.sma @@ -55,6 +55,11 @@ new g_coloredMenus // menuAccess: Access required for menu // menuPlugin: The exact case-insensitive name of plugin holding the menu command public AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[]) { + if (g_menusNumber + 1 == MAXMENUS) { + log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin) + return + } + copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody) g_menuBodyPhrase[g_menusNumber] = false copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd) @@ -66,6 +71,11 @@ public AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPl server_print("Menu item added to Menus Front-End: ^"%s^" from plugin ^"%s^"", menuBody, menuPlugin) } public AddMenuLang(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[]) { + if (g_menusNumber + 1 == MAXMENUS) { + log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin) + return + } + copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody) g_menuBodyPhrase[g_menusNumber] = true copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)