Package: grub-pc Version: 2.00-14 Severity: normal Tags: upstream patch Hitting Ctrl-U deletes to the beginning of the line, but hitting Ctrl-Y afterward yanks a truncated and mangled string. Looking at the code (in grub-core/normal/cmdline.c), it looks like the implementation of Ctrl-U never got converted from 8-bit characters to UCS-4, so it only copies N bytes rather than N characters. The attached patch fixes this problem.
Changelog entry for this patch: 2013-05-27 Josh Triplett <j...@joshtriplett.org> * grub-core/normal/cmdline.c (grub_cmdline_get): Fix Ctrl-u handling to copy the killed characters to the kill buffer as UCS4 stored as grub_uint32_t rather than as 8-bit characters stored as char. Eliminates UCS4 truncation and corruption observed when killing characters with Ctrl-u and yanking them back with Ctrl-y. I've also attached the patch in "bzr send" form for direct application, including the changelog entry. - Josh Triplett -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.8-trunk-amd64 (SMP w/4 CPU cores) Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages grub-pc depends on: ii debconf [debconf-2.0] 1.5.50 ii grub-common 2.00-14 ii grub-pc-bin 2.00-14 ii grub2-common 2.00-14 ii ucf 3.0027 grub-pc recommends no packages. grub-pc suggests no packages. -- debconf information excluded
=== modified file 'grub-core/normal/cmdline.c' --- grub-core/normal/cmdline.c 2013-05-14 06:54:18 +0000 +++ grub-core/normal/cmdline.c 2013-05-28 04:05:19 +0000 @@ -587,7 +587,7 @@ grub_free (kill_buf); - kill_buf = grub_malloc (n + 1); + kill_buf = grub_malloc ((n + 1) * sizeof(grub_uint32_t)); if (grub_errno) { grub_print_error (); @@ -595,8 +595,8 @@ } if (kill_buf) { - grub_memcpy (kill_buf, buf, n); - kill_buf[n] = '\0'; + grub_memcpy (kill_buf, buf, n * sizeof(grub_uint32_t)); + kill_buf[n] = 0; } lpos = 0;
# Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: j...@joshtriplett.org-20130528041348-we4ky0tgt3ric14q # target_branch: http://bzr.savannah.gnu.org/r/grub/trunk/grub/ # testament_sha1: 8b36d29a91d74b33de6f13982863a716d0f734bb # timestamp: 2013-05-27 21:19:56 -0700 # source_branch: . # base_revision_id: phco...@gmail.com-20130515152649-2qzhi2m3wxlvi9z2 # # Begin patch === modified file 'ChangeLog' --- ChangeLog 2013-05-15 15:26:49 +0000 +++ ChangeLog 2013-05-28 04:13:48 +0000 @@ -1,3 +1,12 @@ +2013-05-27 Josh Triplett <j...@joshtriplett.org> + + * grub-core/normal/cmdline.c (grub_cmdline_get): Fix Ctrl-u + handling to copy the killed characters to the kill buffer as + UCS4 stored as grub_uint32_t rather than as 8-bit characters + stored as char. Eliminates UCS4 truncation and corruption + observed when killing characters with Ctrl-u and yanking them + back with Ctrl-y. + 2013-05-15 Radosław Szymczyszyn <lav...@gmail.com> * grub-core/partmap/dfly.c: New partition map. === modified file 'grub-core/normal/cmdline.c' --- grub-core/normal/cmdline.c 2013-05-14 06:54:18 +0000 +++ grub-core/normal/cmdline.c 2013-05-28 04:13:48 +0000 @@ -587,7 +587,7 @@ grub_free (kill_buf); - kill_buf = grub_malloc (n + 1); + kill_buf = grub_malloc ((n + 1) * sizeof(grub_uint32_t)); if (grub_errno) { grub_print_error (); @@ -595,8 +595,8 @@ } if (kill_buf) { - grub_memcpy (kill_buf, buf, n); - kill_buf[n] = '\0'; + grub_memcpy (kill_buf, buf, n * sizeof(grub_uint32_t)); + kill_buf[n] = 0; } lpos = 0; # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWSNx0PcAAmHfgBAwUH///1sU ngq////wUAVs8VdhGXdpToqutASUminqb1TahtNqm1NqeptRmk9TBAMJmoAEohJtAZJpP0oPUNBo A0AABoBIkEKntCnkxDUafpGU/VNABkGmh6hoOaYmAjTAjCMAAAATCMAqkU9BNGiehGCaT1PQ0TUz U9JiAPU0PUa1NGYGCOee8202nye40xTURtLgze62lkmJQq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