Commit f6bb4883 authored by Chong Yidong's avatar Chong Yidong

(read_char_minibuf_menu_prompt): Ensure that

read_char_minibuf_menu_text is large enough to hold the menu string.
parent 6c56a0f3
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment