diff --git a/ChangeLog b/ChangeLog index 190a52591..b883d70be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-29 Vladimir Serbinenko + + * grub-core/osdep/unix/password.c (grub_password_get): Check that + fgets succeeded. + 2013-11-27 Francesco Lavra * docs/grub.texi (ls): Fix command description in case of a device name diff --git a/grub-core/osdep/unix/password.c b/grub-core/osdep/unix/password.c index 2e647c766..470a6ea62 100644 --- a/grub-core/osdep/unix/password.c +++ b/grub-core/osdep/unix/password.c @@ -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;