diff options
| author | Chong Yidong | 2008-10-25 20:23:31 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-10-25 20:23:31 +0000 |
| commit | f6bb48830621e249f46e35d930f77900cb9e3068 (patch) | |
| tree | 89fc71f996c0bc370a32790a09bb3b991a14fe0d /src/keyboard.c | |
| parent | 6c56a0f32ec906d040770591a76cf3adae2e4e88 (diff) | |
| download | emacs-f6bb48830621e249f46e35d930f77900cb9e3068.tar.gz emacs-f6bb48830621e249f46e35d930f77900cb9e3068.zip | |
(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.c | 25 |
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) | |||
| 8558 | if (! menu_prompting) | 8558 | if (! menu_prompting) |
| 8559 | return Qnil; | 8559 | return Qnil; |
| 8560 | 8560 | ||
| 8561 | /* Get the menu name from the first map that has one (a prompt string). */ | ||
| 8562 | for (mapno = 0; mapno < nmaps; mapno++) | ||
| 8563 | { | ||
| 8564 | name = Fkeymap_prompt (maps[mapno]); | ||
| 8565 | if (!NILP (name)) | ||
| 8566 | break; | ||
| 8567 | } | ||
| 8568 | |||
| 8569 | /* If we don't have any menus, just read a character normally. */ | ||
| 8570 | if (!STRINGP (name)) | ||
| 8571 | return Qnil; | ||
| 8572 | |||
| 8561 | /* Make sure we have a big enough buffer for the menu text. */ | 8573 | /* Make sure we have a big enough buffer for the menu text. */ |
| 8574 | width = max (width, SBYTES (name)); | ||
| 8562 | if (read_char_minibuf_menu_text == 0) | 8575 | if (read_char_minibuf_menu_text == 0) |
| 8563 | { | 8576 | { |
| 8564 | read_char_minibuf_menu_width = width + 4; | 8577 | read_char_minibuf_menu_width = width + 4; |
| @@ -8572,18 +8585,6 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) | |||
| 8572 | } | 8585 | } |
| 8573 | menu = read_char_minibuf_menu_text; | 8586 | menu = read_char_minibuf_menu_text; |
| 8574 | 8587 | ||
| 8575 | /* Get the menu name from the first map that has one (a prompt string). */ | ||
| 8576 | for (mapno = 0; mapno < nmaps; mapno++) | ||
| 8577 | { | ||
| 8578 | name = Fkeymap_prompt (maps[mapno]); | ||
| 8579 | if (!NILP (name)) | ||
| 8580 | break; | ||
| 8581 | } | ||
| 8582 | |||
| 8583 | /* If we don't have any menus, just read a character normally. */ | ||
| 8584 | if (!STRINGP (name)) | ||
| 8585 | return Qnil; | ||
| 8586 | |||
| 8587 | /* Prompt string always starts with map's prompt, and a space. */ | 8588 | /* Prompt string always starts with map's prompt, and a space. */ |
| 8588 | strcpy (menu, SDATA (name)); | 8589 | strcpy (menu, SDATA (name)); |
| 8589 | nlength = SBYTES (name); | 8590 | nlength = SBYTES (name); |