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:
parent
7ceeee39d7
commit
9fe8603472
3 changed files with 25 additions and 7 deletions
11
ChangeLog
11
ChangeLog
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
17
kern/misc.c
17
kern/misc.c
|
@ -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,9 +111,13 @@ 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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue