grub_strncat() eats the last char copid from 'dest', this patch should fix it.

diff -ur grub-1.96/kern/misc.c grub-1.96fix/kern/misc.c
--- grub-1.96/kern/misc.c       2008-02-03 21:11:31.000000000 +0800
+++ grub-1.96fix/kern/misc.c    2008-03-20 10:39:36.000000000 +0800
@@ -110,7 +110,8 @@

   while ((*p++ = *src++) != '\0' && --c)
     ;
-  *(--p) = '\0';
+  if (!c)
+    *(p) = '\0';



PS: no body cares about previous patch I sent??
I put it below, it is easy to understand when you read it.

diff -ur grub-1.96/kern/env.c grub-1.96fix/kern/env.c
--- grub-1.96/kern/env.c        2008-01-06 15:15:07.000000000 +0800
+++ grub-1.96fix/kern/env.c     2008-03-12 10:02:07.000000000 +0800
@@ -124,7 +124,7 @@
     {
       struct grub_env_var *p, *q;
       
-      for (p = current_context->prev->vars[i]; p; p = q)
+      for (p = current_context->vars[i]; p; p = q)
        {
          q = p->next;
          grub_free (p);


Zhang Huan
Tel: (86)10-6260-0549
Mailing: P. O. Box 2704# Beijing
Postcode: 100080
National Research Centre for High Performance Computers
Institute of Computing Technology, Chinese Academy of Sciences
No. 6, South Kexueyuan Road, Haidian District
Beijing, China




_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to