diff --git a/ChangeLog b/ChangeLog index beca299c2..abc6212c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-04-26 Vladimir Serbinenko + + * grub-core/term/terminfo.c (grub_terminfo_getkey): Fix incorrect queue + handling. + 2012-04-26 Vladimir Serbinenko * grub-core/disk/diskfilter.c (read_segment): Fix the case when disknr diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c index 7481a79b4..7157ee01e 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -549,9 +549,12 @@ grub_terminfo_getkey (struct grub_term_input *termi) = (struct grub_terminfo_input_state *) (termi->data); if (data->npending) { + int ret; data->npending--; - grub_memmove (data->input_buf, data->input_buf + 1, data->npending); - return data->input_buf[0]; + ret = data->input_buf[0]; + grub_memmove (data->input_buf, data->input_buf + 1, data->npending + * sizeof (data->input_buf[0])); + return ret; } grub_terminfo_readkey (termi, data->input_buf, @@ -559,9 +562,12 @@ grub_terminfo_getkey (struct grub_term_input *termi) if (data->npending) { + int ret; data->npending--; - grub_memmove (data->input_buf, data->input_buf + 1, data->npending); - return data->input_buf[0]; + ret = data->input_buf[0]; + grub_memmove (data->input_buf, data->input_buf + 1, data->npending + * sizeof (data->input_buf[0])); + return ret; } return GRUB_TERM_NO_KEY;