2008-04-13 Robert Millan <rmh@aybabtu.com>

* kern/misc.c (grub_strncat): Fix off-by-one error.
        Reported by Zhang Huan <zhanghuan@nrchpc.ac.cn>

        * kern/env.c (grub_env_context_close): Clear current context, not
        previous one.
        Patch from Zhang Huan <zhanghuan@nrchpc.ac.cn>

        * kern/misc.c (grub_strcat): Minor speed optimization (same code size).
This commit is contained in:
robertmh 2008-04-13 14:58:42 +00:00
parent 7ceeee39d7
commit 9fe8603472
3 changed files with 25 additions and 7 deletions

View File

@ -1,3 +1,14 @@
2008-04-13 Robert Millan <rmh@aybabtu.com>
* kern/misc.c (grub_strncat): Fix off-by-one error.
Reported by Zhang Huan <zhanghuan@nrchpc.ac.cn>
* kern/env.c (grub_env_context_close): Clear current context, not
previous one.
Patch from Zhang Huan <zhanghuan@nrchpc.ac.cn>
* kern/misc.c (grub_strcat): Minor speed optimization (same code size).
2008-04-13 Robert Millan <rmh@aybabtu.com>
Improve robustness when handling LVM.

View File

@ -124,7 +124,7 @@ grub_env_context_close (void)
{
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);

View File

@ -94,8 +94,11 @@ grub_strcat (char *dest, const char *src)
while (*p)
p++;
while ((*p++ = *src++) != '\0')
;
while ((*p = *src) != '\0')
{
p++;
src++;
}
return dest;
}
@ -108,10 +111,14 @@ grub_strncat (char *dest, const char *src, int c)
while (*p)
p++;
while ((*p++ = *src++) != '\0' && --c)
;
*(--p) = '\0';
while ((*p = *src) != '\0' && c--)
{
p++;
src++;
}
*p = '\0';
return dest;
}