Eliminate grub_min/grub_max prone to overflow usage.
* grub-core/bus/usb/usbhub.c (grub_usb_add_hub): Eliminate grub_min. (poll_nonroot_hub): Likewise. * grub-core/fs/affs.c (grub_affs_iterate_dir): Likewise. (grub_affs_label): Likewise. * grub-core/fs/btrfs.c (grub_btrfs_lzo_decompress): Likewise. * grub-core/fs/hfs.c (grub_hfs_dir): Likewise. (grub_hfs_label): Likewise. * grub-core/fs/hfsplus.c (grub_hfsplus_cmp_catkey): Likewise. * grub-core/fs/zfs/zfs.c (MIN): Remove. (zap_leaf_array_equal): Use grub_size. Remove MIN. (zap_leaf_array_get): Likewise. (dnode_get_path): Likewise. * grub-core/io/lzopio.c (grub_lzopio_read): Eliminate grub_min. * grub-core/io/xzio.c (grub_xzio_read): Likewise. * grub-core/script/execute.c (grub_script_break): Likewise. * grub-core/script/lexer.c (grub_script_lexer_record): Eliminate grub_max. * grub-core/script/yylex.l (grub_lexer_yyrealloc): Likewise. * include/grub/misc.h (grub_min): Removed. (grub_max): Likewise.
This commit is contained in:
parent
80662dbc5d
commit
9c2710789f
13 changed files with 97 additions and 57 deletions
|
@ -1150,10 +1150,14 @@ grub_hfs_dir (grub_device_t device, const char *path,
|
|||
struct grub_hfs_catalog_key *ckey = rec->key;
|
||||
char fname[sizeof (ckey->str) * MAX_UTF8_PER_MAC_ROMAN + 1] = { 0 };
|
||||
struct grub_dirhook_info info;
|
||||
grub_size_t len;
|
||||
|
||||
grub_memset (&info, 0, sizeof (info));
|
||||
|
||||
macroman_to_utf8 (fname, ckey->str, grub_min (ckey->strlen,
|
||||
sizeof (ckey->str)));
|
||||
len = ckey->strlen;
|
||||
if (len > sizeof (ckey->str))
|
||||
len = sizeof (ckey->str);
|
||||
macroman_to_utf8 (fname, ckey->str, len);
|
||||
|
||||
info.case_insensitive = 1;
|
||||
|
||||
|
@ -1272,8 +1276,9 @@ grub_hfs_label (grub_device_t device, char **label)
|
|||
|
||||
if (data)
|
||||
{
|
||||
grub_size_t len = grub_min (sizeof (data->sblock.volname) - 1,
|
||||
data->sblock.volname[0]);
|
||||
grub_size_t len = data->sblock.volname[0];
|
||||
if (len > sizeof (data->sblock.volname) - 1)
|
||||
len = sizeof (data->sblock.volname) - 1;
|
||||
*label = grub_malloc (len * MAX_UTF8_PER_MAC_ROMAN + 1);
|
||||
if (*label)
|
||||
macroman_to_utf8 (*label, data->sblock.volname + 1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue