Commit graph

211 commits

Author SHA1 Message Date
Pete Batard
bdd89d239c core: use GRUB_TERM_ definitions when handling term characters
* Also use hex value for GRUB_TERM_ESC as '\e' is not in the C standard and is not understood by some compilers
2017-08-07 19:28:22 +02:00
AppChecker
a0fe0c26aa crypto: Fix use after free.
Reported by: AppChecker
Transformed to patch by: Satish Govindarajan
2017-07-09 21:57:35 +02:00
Vladimir Serbinenko
0fd9fa565b charset: Trim away RLM and LRM.
They are not visible but would otherwise end up as [LRM] or [RLM] squares
with some fonts.
2017-01-31 19:29:31 +01:00
Thomas Huth
625934ec0f menu_entry: Disable cursor during update_screen()
When running grub in a VGA console of a KVM pseries guest on PowerPC,
you can see the cursor sweeping over the whole line when entering a
character in editor mode. This is visible because grub always refreshes
the whole line when entering a character in editor mode, and drawing
characters is quite a slow operation with the firmware used for the
powerpc pseries guests (SLOF).
To avoid this ugliness, the cursor should be disabled when refreshing
the screen contents during update_screen().

Signed-off-by: Thomas Huth <thuth@redhat.com>
2016-02-22 09:59:27 +03:00
Andrei Borzenkov
26533fe6bc normal: fix memory leak
Found by: Coverity scan.
CID: 96641, 96670, 96667
2016-01-12 22:40:03 +03:00
Andrei Borzenkov
93ecc3f1f8 menu: fix line count calculation for long lines
It gave one extra screen line if length was exactly equal to screen
width.

Reported by Michael Chang.
Also-By: Michael Chang <mchang@suse.com>
2015-12-30 06:20:51 +03:00
Andrei Borzenkov
7136b545c1 Erase backspaced character in grub_username_get
It probably does not work across linefeed, but hopefully user names are not
that long (and nobody is using terminal that small).
2015-12-16 19:20:10 +03:00
Hector Marco-Gisbert
451d80e52d Fix security issue when reading username and password
This patch fixes two integer underflows at:
  * grub-core/lib/crypto.c
  * grub-core/normal/auth.c

CVE-2015-8370

Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
Signed-off-by: Ismael Ripoll-Ripoll <iripoll@disca.upv.es>
Also-By: Andrey Borzenkov <arvidjaar@gmail.com>
2015-12-16 07:57:18 +03:00
Andrei Borzenkov
152695d0fa normal: fix memory leak
Found by: Coverity scan.
CID: 96677
2015-06-20 23:38:19 +03:00
Andrei Borzenkov
2a3ebf9428 normal: fix memory leak
Found by: Coverity scan.
CID: 96685
2015-06-20 23:38:18 +03:00
Michael Zimmermann
ed07b7e128 Add missing initializers to silence suprious warnings. 2015-03-27 14:44:41 +01:00
Vladimir Serbinenko
9ee5ae1fae Document intentional fallthroughs.
Found by: Coverity scan.
2015-01-27 17:17:58 +01:00
Vladimir Serbinenko
6603c22f31 normal/misc: Close device on all pathes.
Found by: Coverity scan.
2015-01-26 09:49:32 +01:00
Vladimir Serbinenko
73b1e83839 normal/main: Fix error handling.
Found by: Coverity scan.
2015-01-26 09:48:46 +01:00
Vladimir Serbinenko
44b38e4988 grub_menu_init_page: Avoid returning 0 geometry to avoid divisions by 0. 2015-01-21 17:42:15 +01:00
Vladimir Serbinenko
59d4036594 Replace explicit sizeof divisions by ARRAY_SIZE. 2015-01-21 17:37:31 +01:00
Vladimir Serbinenko
41c6f91fce * grub-core/normal/main.c: Don't drop to rescue console in
case of password-protected prompt and no menu entries.
2014-09-21 18:51:09 +02:00
Vladimir Serbinenko
5e42618e00 Fix wrong commit 2014-09-21 18:18:03 +02:00
Michael Chang
0aece00c54 * grub-core/osdep/unix/config.c: Remove extraneous comma. 2014-09-21 17:49:13 +02:00
Vladimir Serbinenko
41155a5722 * grub-core/normal/main.c (read_config_file): Buffer config file.
Reduces boot time.
2014-01-18 19:54:09 +01:00
Vladimir Serbinenko
5dbde526a8 Inline printf templates when possible to enable format checking. 2013-12-21 13:40:18 +01:00
Vladimir Serbinenko
8f5add13ff Implement syslinux parser. 2013-12-18 05:28:05 +01:00
Vladimir Serbinenko
dafff9ce44 * grub-core/normal/charset.c: Fix premature line wrap and crash.
Crash happened only in some cases like a string starting at the
	half of the screen of same length.
2013-12-11 17:06:00 +01:00
Andrey Borzenkov
9f2f979bcf always define config_directory and config_file as full pathname
If configfile is relative pathname, extend it with current ($root) so its
interpretation does not change if $root is changed later.

Suggested by Vladimir Serbienko.
2013-12-10 09:55:27 +04:00
Andrey Borzenkov
bb05e313eb use light-gray as default color in normal.mod for consistency
Defalut font color on PC console seems to be light-gray; this is
what user also gets in rescue prompt and what is defined as
GRUB_TERM_DEFAULT_NORMAL_COLOR. But normal.mod defaults to white.
This makes unpleasant visual effect as colors are changed after kernel
is booted.

Use the same color eveywhere for consistency and default to light-gray
as this is also what at least Linux kernel is using by default.
2013-12-07 20:00:48 +04:00
Vladimir Serbinenko
6f07c4e407 Pass font config to config.h and not by TARGET_CFLAGS as adding
arguments doesn't work if TARGET_CFLAGS is specified on command
	line.
2013-12-04 10:25:53 +01:00
Colin Watson
f315b508ae Reduce nesting level. 2013-12-03 16:11:00 +00:00
Colin Watson
8f236c1419 Revamp hidden timeout handling
Add a new timeout_style environment variable and a corresponding
GRUB_TIMEOUT_STYLE configuration key for grub-mkconfig.  This
controls hidden-timeout handling more simply than the previous
arrangements, and pressing any hotkeys associated with menu entries
during the hidden timeout will now boot the corresponding menu entry
immediately.

GRUB_HIDDEN_TIMEOUT=<non-empty> + GRUB_TIMEOUT=<non-zero> now
generates a warning, and if it shows the menu it will do so as if
the second timeout were not present.  Other combinations are
translated into reasonable equivalents.
2013-11-28 02:29:15 +00:00
Colin Watson
b7f9aedfac * grub-core/normal/progress.c: Remove unused file. 2013-11-21 15:37:57 +00:00
Vladimir Serbinenko
35d4761ce2 * grub-core/normal/cmdline.c (grub_cmdline_get): Plug memory leak. 2013-11-18 02:43:29 +01:00
Vladimir Serbinenko
b2e9294fb9 * grub-core/normal/datetime.c (grub_get_weekday): Use if rather than
division.
2013-11-13 09:26:13 +01:00
Josh Triplett
46d8a2033b * grub-core/normal/term.c (grub_set_more): Use bool logic rather than
increment/decrement.
2013-11-13 02:27:11 +01:00
Vladimir Serbinenko
800f63d38f * grub-core/normal/datetime.c (grub_get_weekday): Use unsigned types. 2013-11-08 19:14:03 +01:00
Vladimir Serbinenko
a67c755ef1 * grub-core/normal/cmdline.c (grub_cmdline_get):
Remove nested functions.
2013-11-07 02:42:38 +01:00
Vladimir Serbinenko
c03995d297 * grub-core/normal/charset.c (bidi_line_wrap): Eliminate nested
functions.
	(grub_bidi_line_logical_to_visual): Likewise.
2013-11-07 02:31:31 +01:00
Vladimir Serbinenko
e54b8f536b * include/grub/misc.h (grub_strcat): Removed. All users changed to
more appropriate functions.
2013-11-01 16:27:37 +01:00
Vladimir Serbinenko
10bafa1c38 * grub-core/normal/datetime.c (grub_unixtime2datetime): Fix mishandling
of first three years after start of validity of unixtime.
2013-10-26 02:47:40 +02:00
Vladimir Serbinenko
b1c6d03760 * grub-core/normal/menu_entry.c (get_logical_num_lines): Use unsigned
division as the one making more sense.
	(update_screen): Likewise.
	(complete): Likewise.
2013-10-26 01:01:06 +02:00
Vladimir Serbinenko
5f4028d4a5 * grub-core/normal/menu_entry.c (complete): Make sure that width is >0. 2013-10-26 00:07:59 +02:00
Vladimir Serbinenko
a28567364a Make char and string width grub_size_t rather than grub_ssize_t. 2013-10-25 23:58:24 +02:00
Vladimir Serbinenko
0a7e52b2ed * grub-core/normal/cmdline.c (grub_history_get): Make argument into
unsigned.
	(grub_history_replace): Likewise.
2013-10-25 22:58:19 +02:00
Vladimir 'phcoder' Serbinenko
c7037f1d0f * grub-core/normal/completion.c: Remove variable length arrays.
* grub-core/normal/menu_entry.c: Likewise.

	Reduces normal.mod by 496 bytes.
2013-10-20 13:55:35 +02:00
Vladimir 'phcoder' Serbinenko
e89c2d48a9 Lift 255x255 erminal sie restriction to 65535x65535. Also change from
bitmasks to small structures of size chosen to fit in registers.
2013-10-19 23:59:32 +02:00
Vladimir 'phcoder' Serbinenko
c06c75201c Split grub-setup.c into frontend (grub-setup.c) and backend (setup.c)
files.
2013-10-15 16:16:04 +02:00
Vladimir 'phcoder' Serbinenko
a2371e19b3 * grub-core/normal/charset.c (bidi_line_wrap): Fix spurios warning. 2013-07-11 13:34:20 +02:00
Andrey Borzenkov
593e430cd6 * grub-core/script/execute.c (grub_script_execute_sourcecode): Split
off new function grub_script_execute_new_scope. Change callers to use
	either of them as appropriate.
	* grub-core/commands/eval.c: New command eval.
	* docs/grub.texi (Commands): Document it.
2013-06-07 18:36:42 +02:00
Josh Triplett
e40b459617 * grub-core/normal/cmdline.c (grub_cmdline_get): Fix Ctrl-u
handling to copy the killed characters to the kill buffer as
	UCS4 stored as grub_uint32_t rather than as 8-bit characters
	stored as char.  Eliminates UCS4 truncation and corruption
	observed when killing characters with Ctrl-u and yanking them
	back with Ctrl-y.
2013-05-31 00:59:02 +02:00
Vladimir 'phcoder' Serbinenko
cdce14fad4 Progressively skip menu elements on small terminals rather
than crashing.
2013-05-14 08:57:18 +02:00
Vladimir 'phcoder' Serbinenko
c8d6cc3cf0 * grub-core/normal/cmdline.c (grub_cmdline_get): Fix off-by-one error
to avoid losing last column.
2013-05-14 08:54:18 +02:00
Vladimir 'phcoder' Serbinenko
d22840ec12 Mark few forgotten strings for translation. 2013-05-07 11:41:47 +02:00