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
|
@ -928,13 +928,17 @@ grub_btrfs_lzo_decompress(char *ibuf, grub_size_t isize, grub_off_t off,
|
|||
/* Block partially filled with requested data. */
|
||||
if (off > 0 || osize < GRUB_BTRFS_LZO_BLOCK_SIZE)
|
||||
{
|
||||
grub_size_t to_copy = grub_min(osize, GRUB_BTRFS_LZO_BLOCK_SIZE - off);
|
||||
grub_size_t to_copy = GRUB_BTRFS_LZO_BLOCK_SIZE - off;
|
||||
|
||||
if (to_copy > osize)
|
||||
to_copy = osize;
|
||||
|
||||
if (lzo1x_decompress_safe ((lzo_bytep)ibuf, cblock_size, buf, &usize,
|
||||
NULL) != LZO_E_OK)
|
||||
return -1;
|
||||
|
||||
to_copy = grub_min(to_copy, usize);
|
||||
if (to_copy > usize)
|
||||
to_copy = usize;
|
||||
grub_memcpy(obuf, buf + off, to_copy);
|
||||
|
||||
osize -= to_copy;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue