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

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

No files matched your search

+3 -1
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;