* include/grub/misc.h (grub_strncat): Fix the order of conditionals to

avoid accessing beyond the array.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-11-09 14:47:45 +01:00
parent 19e81ba7a0
commit 57b0125004
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-11-09 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/misc.h (grub_strncat): Fix the order of conditionals to
avoid accessing beyond the array.
2011-11-09 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Add missing -mXX to TARGET_CPPFLAGS.

View File

@ -87,7 +87,7 @@ grub_strncat (char *dest, const char *src, int c)
while (*p)
p++;
while ((*p = *src) != '\0' && c--)
while (c-- && (*p = *src) != '\0')
{
p++;
src++;