Andrei Borzenkov
6e21195890
progress: avoid NULL dereference for net files
...
From original patch by dann frazier <dann.frazier@canonical.com>:
grub_net_fs_open() saves off a copy of the file structure it gets passed and
uses it to create a bufio structure. It then overwrites the passed in file
structure with this new bufio structure. Since file->name doesn't get set
until we return back to grub_file_open(), it means that only the bufio
structure gets a valid file->name. The "real" file's name is left
uninitialized. This leads to a crash when the progress module hook is called
on it.
grub_net_fs_open() already saved copy of file name as ->net->name, so change
progress module to use it.
Also, grub_file_open may leave file->name as NULL if grub_strdup fails. Check
for it.
Also-By: dann frazier <dann.frazier@canonical.com>
2015-10-10 11:44:14 +03:00
Vladimir Serbinenko
74124c344c
* grub-core/lib/progress.c (grub_file_progress_hook_real): Add missing
...
safeguards. Fixes a crash with i386/pc/console.c.
2013-10-28 13:37:40 +01:00
Vladimir Serbinenko
ea899a5760
* grub-core/lib/progress.c (grub_file_progress_hook_real): Cast to
...
unsigned long long when using %llu.
2013-10-25 15:22:30 +02:00
Vladimir Serbinenko
c6dc6fa175
* grub-core/lib/progress.c (grub_file_progress_hook_real): Refresh
...
terminal after updating progress.
2013-10-25 11:57:36 +02:00
Vladimir Serbinenko
238f048987
* grub-core/lib/progress.c (grub_file_progress_hook_real): Use
...
divmod64 for offset division.
2013-10-23 17:34:49 +02:00
Paulo Flabiano Smorigo
84a0e9699f
Add progress module to display load progress of files.
...
* grub-core/lib/progress.c: New file.
* grub-core/Makefile.core.def (progress): New module.
* grub-core/kern/file.c (grub_file_open): File name added.
* (grub_file_read): Progress hook added.
* grub-core/fs/cbfs.c (grub_cbfs_read): Likewise.
* grub-core/fs/cpio_common.c (grub_cpio_read): Likewise.
* grub-core/net/net.c (grub_net_fs_read_real): Likewise.
* include/grub/file.h (struct grub_file): Add progress module
* members.
* include/grub/term.h (struct grub_term_output): Likewise.
* grub-core/osdep/unix/emuconsole.c (grub_console_term_output):
Terminal velocity added.
* grub-core/osdep/windows/emuconsole.c (grub_console_term_output):
* Likewise.
* grub-core/term/arc/console.c (grub_console_term_output): Likewise.
* grub-core/term/efi/console.c (grub_console_term_output): Likewise.
* grub-core/term/gfxterm.c (grub_video_term): Likewise.
* grub-core/term/i386/coreboot/cbmemc.c (grub_cbmemc_term_output):
* Likewise.
* grub-core/term/i386/pc/console.c (grub_console_term_output):
* Likewise.
* grub-core/term/i386/pc/vga_text.c (grub_vga_text_term): Likewise.
* grub-core/term/ieee1275/console.c (grub_console_term_output):
* Likewise.
* grub-core/term/morse.c (grub_audio_term_output): Likewise.
* grub-core/term/serial.c (grub_serial_term_output): Likewise.
* grub-core/term/spkmodem.c (grub_spkmodem_term_output): Likewise.
* grub-core/term/uboot/console.c (uboot_console_term_output):
* Likewise.
2013-10-22 16:42:20 -02:00