* commands/cat.c (grub_cmd_cat): Fix buffer overrun if '\r' is the
last character in the buffer. Reported by: Vladimir Serbinenko.
This commit is contained in:
parent
dccaf99d10
commit
1ba9b88946
2 changed files with 7 additions and 1 deletions
|
@ -63,7 +63,7 @@ grub_cmd_cat (grub_extcmd_t cmd, int argc, char **args)
|
|||
|
||||
if ((grub_isprint (c) || grub_isspace (c)) && c != '\r')
|
||||
grub_putchar (c);
|
||||
else if (dos && c == '\r' && buf[i + 1] == '\n')
|
||||
else if (dos && c == '\r' && i + 1 < size && buf[i + 1] == '\n')
|
||||
{
|
||||
grub_putchar ('\n');
|
||||
i++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue