From f425236bac45bb23115c817e0620e255c64f2b3f Mon Sep 17 00:00:00 2001 From: peace-maker Date: Mon, 20 Jun 2016 17:03:54 +0200 Subject: [PATCH] Increase topmenu display buffer size (#520) The buffer for menu options was 64 chars. That limit can easily be reached by some utf8 string which would get truncated. Double the buffer size to 128 chars. --- extensions/topmenus/TopMenu.cpp | 4 ++-- extensions/topmenus/TopMenu.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/topmenus/TopMenu.cpp b/extensions/topmenus/TopMenu.cpp index 8d4738c5..28a17391 100644 --- a/extensions/topmenus/TopMenu.cpp +++ b/extensions/topmenus/TopMenu.cpp @@ -36,7 +36,7 @@ struct obj_by_name_t { unsigned int obj_index; - char name[64]; + char name[TOPMENU_DISPLAY_BUFFER_SIZE]; }; int _SortObjectNamesDescending(const void *ptr1, const void *ptr2); @@ -667,7 +667,7 @@ unsigned int TopMenu::OnMenuDisplayItem(IBaseMenu *menu, return 0; /* Ask the object to render the text for this client */ - char renderbuf[64]; + char renderbuf[TOPMENU_DISPLAY_BUFFER_SIZE]; obj->callbacks->OnTopMenuDisplayOption(this, client, obj->object_id, renderbuf, sizeof(renderbuf)); /* Build the new draw info */ diff --git a/extensions/topmenus/TopMenu.h b/extensions/topmenus/TopMenu.h index b20f1afb..a22a1ba0 100644 --- a/extensions/topmenus/TopMenu.h +++ b/extensions/topmenus/TopMenu.h @@ -42,6 +42,8 @@ using namespace SourceHook; using namespace SourceMod; +#define TOPMENU_DISPLAY_BUFFER_SIZE 128 + struct config_category_t { int name;