* grub-core/osdep/unix/password.c (grub_password_get): Check that

fgets succeeded.
This commit is contained in:
Vladimir Serbinenko 2013-11-29 03:32:57 +01:00
parent b67422d33d
commit 83c256ba42
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2013-11-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/osdep/unix/password.c (grub_password_get): Check that
fgets succeeded.
2013-11-27 Francesco Lavra <francescolavra.fl@gmail.com>
* docs/grub.texi (ls): Fix command description in case of a device name

View file

@ -51,7 +51,9 @@ grub_password_get (char buf[], unsigned buf_size)
}
else
tty_changed = 0;
fgets (buf, buf_size, stdin);
grub_memset (buf, 0, buf_size);
if (!fgets (buf, buf_size, stdin))
return 0;
ptr = buf + strlen (buf) - 1;
while (buf <= ptr && (*ptr == '\n' || *ptr == '\r'))
*ptr-- = 0;