summaryrefslogtreecommitdiff
path: root/app/wlib/mswlib/mswmenu.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:00 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:00 +0200
commitb623f5953691b2a0614e6f1f4def86bdbb9a4113 (patch)
tree18102bd36f7e22eb2ba2b9f880e4cb29346f4cb8 /app/wlib/mswlib/mswmenu.c
parent359b557176b9bb2ff1aed2082641eed39c358d0d (diff)
New upstream version 5.2.0Beta2.1upstream/5.2.0Beta2.1
Diffstat (limited to 'app/wlib/mswlib/mswmenu.c')
-rw-r--r--app/wlib/mswlib/mswmenu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/wlib/mswlib/mswmenu.c b/app/wlib/mswlib/mswmenu.c
index 815752a..d56e24d 100644
--- a/app/wlib/mswlib/mswmenu.c
+++ b/app/wlib/mswlib/mswmenu.c
@@ -31,6 +31,7 @@
#include <math.h>
#include <ctype.h>
#include <assert.h>
+#include "misc.h"
#include "mswint.h"
#include "i18n.h"
@@ -579,7 +580,7 @@ wMenuPush_p wMenuPushCreate(
{
wMenuPush_p mi;
int rc;
- char label[80];
+ char *label = malloc(strlen(labelStr) + 30 ); /**< The label and sufficient space for the keyboard shortcut */
char *cp;
char ac;
UINT vk;
@@ -591,9 +592,9 @@ wMenuPush_p wMenuPushCreate(
mi->mparent = m;
mi->acclKey = acclKey;
mi->enabled = TRUE;
- strcpy( label, mi->labelStr );
+ strcpy(label, labelStr);
modifier = 0;
- if ( acclKey != 0 ) {
+ if ( acclKey != 0 && strlen(label ) < 60 ) {
DYNARR_APPEND( acclTable_t, acclTable_da, 10 );
cp = label + strlen( label );
*cp++ = '\t';
@@ -625,6 +626,7 @@ wMenuPush_p wMenuPushCreate(
acclTable(acclTable_da.cnt-1).mp = mi;
}
rc = AppendMenu( m->menu, MF_STRING, mi->index, label );
+ free(label);
return mi;
}