summaryrefslogtreecommitdiff
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2008-10-25 20:23:31 +0000
committerChong Yidong <cyd@stupidchicken.com>2008-10-25 20:23:31 +0000
commitf6bb48830621e249f46e35d930f77900cb9e3068 (patch)
tree89fc71f996c0bc370a32790a09bb3b991a14fe0d /src/keyboard.c
parent6c56a0f32ec906d040770591a76cf3adae2e4e88 (diff)
downloademacs-f6bb48830621e249f46e35d930f77900cb9e3068.tar.gz
(read_char_minibuf_menu_prompt): Ensure that
read_char_minibuf_menu_text is large enough to hold the menu string.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index ec1b117a13a..b6834e97a8f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -8558,7 +8558,20 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
if (! menu_prompting)
return Qnil;
+ /* Get the menu name from the first map that has one (a prompt string). */
+ for (mapno = 0; mapno < nmaps; mapno++)
+ {
+ name = Fkeymap_prompt (maps[mapno]);
+ if (!NILP (name))
+ break;
+ }
+
+ /* If we don't have any menus, just read a character normally. */
+ if (!STRINGP (name))
+ return Qnil;
+
/* Make sure we have a big enough buffer for the menu text. */
+ width = max (width, SBYTES (name));
if (read_char_minibuf_menu_text == 0)
{
read_char_minibuf_menu_width = width + 4;
@@ -8572,18 +8585,6 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
}
menu = read_char_minibuf_menu_text;
- /* Get the menu name from the first map that has one (a prompt string). */
- for (mapno = 0; mapno < nmaps; mapno++)
- {
- name = Fkeymap_prompt (maps[mapno]);
- if (!NILP (name))
- break;
- }
-
- /* If we don't have any menus, just read a character normally. */
- if (!STRINGP (name))
- return Qnil;
-
/* Prompt string always starts with map's prompt, and a space. */
strcpy (menu, SDATA (name));
nlength = SBYTES (name);