From: Vladimir Serbinenko Date: Fri, 29 Nov 2013 02:32:57 +0000 (+0100) Subject: * grub-core/osdep/unix/password.c (grub_password_get): Check that X-Git-Tag: grub-2.02-beta1~196 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=83c256ba421705105eecedd06f97a64b3da79277;p=thirdparty%2Fgrub.git * grub-core/osdep/unix/password.c (grub_password_get): Check that fgets succeeded. --- 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;