Commit graph

6195 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
9c2710789f 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.
2012-01-14 15:44:34 +01:00
Vladimir 'phcoder' Serbinenko
80662dbc5d * grub-core/fs/ext2.c (grub_ext2_iterate_dir): Ignore entries with
direct.inode = 0.
2012-01-14 11:55:20 +01:00
Vladimir 'phcoder' Serbinenko
e6da146746 * grub-core/lib/posix_wrap/wctype.h (CHARCLASS_NAME_MAX): New define. 2012-01-14 11:53:29 +01:00
Vladimir 'phcoder' Serbinenko
b1ac4cb1f9 * include/grub/datetime.h (grub_datetime2unixtime): Fix offset. 2012-01-14 11:51:52 +01:00
Vladimir 'phcoder' Serbinenko
b4bf7c3b20 * grub-core/lib/posix_wrap/stdlib.h (MB_CUR_MAX): Moved from here ...
* grub-core/lib/posix_wrap/wchar.h (MB_CUR_MAX): ... here. Value fixed.
2012-01-14 11:48:56 +01:00
Vladimir 'phcoder' Serbinenko
8ee1101a97 * grub-core/fs/fshelp.c (grub_fshelp_find_file): Use grub_strcasecmp
rather than a hack for grub_strncasemap.
2012-01-14 11:46:13 +01:00
Vladimir 'phcoder' Serbinenko
280d9d3e3e * grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Skip
disks with unknown size.
	* grub-core/disk/raid.c (scan_devices): Allow disks with unknown sizes.
2012-01-14 11:42:52 +01:00
Vladimir 'phcoder' Serbinenko
4d1e2bc9e3 * grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Skip
disks with unknown size.
	* grub-core/disk/raid.c (scan_devices): Allow disks with unknown sizes.
2012-01-14 11:37:34 +01:00
Vladimir 'phcoder' Serbinenko
75b49ebed9 Remove defines pertaining to arbitrary limits not affecting GRUB
anymore.

	* grub-core/fs/ext2.c (EXT2_PATH_MAX): Removed.
	(EXT2_MAX_SYMLINKCNT): Likewise.
	* grub-core/fs/nilfs2.c (NILFS_BTREE_LEVEL_MAX): Likewise.
	* grub-core/net/tftp.c (TFTP_MAX_PACKET): Likewise.
	* include/grub/i386/pc/pxe.h (GRUB_PXE_MIN_BLKSIZE): Likewise.
	(GRUB_PXE_MAX_BLKSIZE): Likewise.
	* include/grub/normal.h (GRUB_MAX_CMDLINE): Likewise.
	* include/grub/zfs/dnode.h (DN_MAX_INDBLKSHIFT): Likewise.
	(DN_MAX_OBJECT_SHIFT): Likewise.
	(DN_MAX_OFFSET_SHIFT): Likewise.
	(DN_MAX_OBJECT): Likewise.
	(DNODES_PER_LEVEL_SHIFT): Likewise.
	* include/grub/zfs/spa.h (SPA_MAXBLOCKSHIFT): Likewise.
	(SPA_MAXBLOCKSIZE): Likewise.
	(SPA_BLOCKSIZES): Likewise.
	* include/grub/zfs/zap_impl.h (MZAP_MAX_BLKSHIFT): Likewise.
	(MZAP_MAX_BLKSZ): Likewise.
2012-01-14 11:30:43 +01:00
Vladimir 'phcoder' Serbinenko
74a1dce71d * grub-core/fs/zfs/zfs.c (grub_zfs_read): Remove useless alloc and
handle NULL appropriately.
	Remove MIN.
2012-01-14 11:23:51 +01:00
Vladimir 'phcoder' Serbinenko
30c7d3ce34 Fix efiemu.
* grub-core/efiemu/runtime/efiemu.c: explicitly include right
	cpu/types.h.
	(efiemu_set_virtual_address_map): Remove UINT_TO_PTR.
	* configure.ac: Fix efiemu check.
2012-01-13 15:12:28 +01:00
Vladimir 'phcoder' Serbinenko
3c76ea0c2c * util/grub.d/30_os-prober.in: Fix occurence of grub-probe instead of
grub_probe.
	Reported by: adamwill
2012-01-13 13:54:24 +01:00
Seth Goldberg
7e532280bd * grub-core/lib/arg.c (grub_arg_parse): Fix NULL pointer dereference. 2012-01-12 22:20:29 +01:00
Vladimir 'phcoder' Serbinenko
3049237440 Fix handling of wide characters in gfxterm.
* grub-core/term/gfxterm.c (grub_colored_char): Remove width and index.
	(clear_char): Likewise.
	(paint_char): Skip code == NULL chars.
	(grub_gfxterm_putchar): Set code = NULL on "shadowed" positions.
2012-01-12 22:16:07 +01:00
Vladimir 'phcoder' Serbinenko
e70cb72f73 * grub-core/normal/charset.c: Move comment to right place. 2012-01-12 22:13:20 +01:00
Vladimir 'phcoder' Serbinenko
5c827cf971 * grub-core/fs/affs.c (grub_affs_bblock): Revert flags.
(GRUB_AFFS_FLAG_FFS): Put back where it was.
	(grub_affs_mount): Revert the correct version checking.
2012-01-11 12:53:38 +01:00
Vladimir 'phcoder' Serbinenko
53603892df * docs/grub.texi (Unicode): Mention several other unsupported features. 2012-01-11 12:50:04 +01:00
Vladimir 'phcoder' Serbinenko
ff094b9b57 * grub-core/fs/squash4.c (squash_mount): Mark endian conversion in
case statements as compile-time one.
	(direct_read): Prevent spurious warnings.
	(grub_squash_read_data): Likewise.
2012-01-11 12:46:50 +01:00
Vladimir 'phcoder' Serbinenko
c029da8a89 Various squash4 fixes and LZO and XZ support.
* Makefile.util.def (libgrubmods.a): Add xzembed directory to cppflags.
	Add xzembed source files.
	* grub-core/Makefile.core.def (squash4): Add xzembed and minilzo flags.
	* grub-core/fs/squash4.c (grub_squash_super): New field compression.
	(grub_squash_inode): New subtype long_dir.
	(SQUASH_TYPE_LONG_DIR): New inode type.
	(COMPRESSION): New enum.
	(XZBUFSIZ): New const.
	(grub_squash_data): New fields blksz, decompress, xzdec, xzbuf.
	(read_chunk): Use data->decompress.
	(zlib_decompress): New function.
	(lzo_decompress): Likewise.
	(xz_decompress): Likewise.
	(squash_mount): Set new data fields.
	(grub_squash_iterate_dir): Handle long dir.
	(squash_unmount): Free xzdec and xzbuf.
	(grub_squash_open): Check ino type.
	(direct_read): Stylistic fixes. Use data->decompress.
	(grub_squash_read_data): Likewise.
	* grub-core/io/gzio.c (grub_gzio): Remove disk_input.
	(get_byte): Likewise.
	(grub_zlib_disk_read): Removed.
	* grub-core/lib/posix_wrap/sys/types.h (ssize_t): New type.
	(GRUB_POSIX_BOOL_DEFINED): New define.
	* grub-core/lib/posix_wrap/unistd.h: Include sys/types.h.
	* grub-core/lib/xzembed/xz.h: Addmissing includes.
	[!GRUB_POSIX_BOOL_DEFINED]: Define bool.
	* include/grub/deflate.h (grub_zlib_disk_read): Removed.
2011-12-26 13:18:01 +01:00
Vladimir 'phcoder' Serbinenko
7a45a539db Don't override more informative errors.
* grub-core/commands/acpi.c (grub_cmd_acpi): Don't override errors.
	* grub-core/font/font.c (open_section): Likewise.
	* grub-core/loader/i386/bsd.c (grub_bsd_load_aout): New argument
	filename. Don't override errors.
	(grub_cmd_openbsd_ramdisk): Don't override errors.
	* grub-core/loader/i386/linux.c (grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	* grub-core/loader/i386/pc/linux.c (grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	* grub-core/loader/ia64/efi/linux.c (grub_load_elf64): Likewise.
	(grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	(grub_cmd_payload): Likewise.
	* grub-core/loader/mips/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/multiboot.c (grub_cmd_multiboot): Likewise.
	(grub_cmd_module): Likewise.
	* grub-core/loader/powerpc/ieee1275/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/sparc64/ieee1275/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/xnu.c (grub_xnu_load_driver): Likewise.
	(grub_cmd_xnu_mkext): Likewise.
	(grub_cmd_xnu_ramdisk): Likewise.
	(grub_xnu_check_os_bundle_required): Likewise.
	(grub_xnu_load_kext_from_dir): Likewise.
	(grub_cmd_xnu_kextdir): Likewise.
	* grub-core/loader/xnu_resume.c (grub_xnu_resume): Likewise.
2011-12-26 12:58:08 +01:00
Vladimir 'phcoder' Serbinenko
b2d004db18 * grub-core/fs/minix.c (grub_minix_mount) [MODE_MINIX3]: Treat 0xffff
as 1024 in block size field. Found on one of my test images.
	Small optimisation while on it.
2011-12-25 22:44:42 +01:00
Vladimir 'phcoder' Serbinenko
ec000eaca9 * docs/grub.texi (Filesystems): Mention SFS as Latin1 filesystem.
* grub-core/fs/sfs.c (grub_sfs_mount): Fix a memory leak while on it.
	(grub_sfs_iterate_dir): Convert Latin1 to UTF8. Stylistic and
	performance fixes while on it.
	(grub_sfs_close): Fix memory leak while on it.
	(grub_sfs_label): Convert Latin1 to UTF-8.
2011-12-25 22:39:56 +01:00
Vladimir 'phcoder' Serbinenko
f50e11653e * grub-core/fs/hfs.c (grub_hfs_dir): Cap keylen to actually available
space to avoid overflows.
	(grub_hfs_label): Convert from macroman to UTF-8.
2011-12-25 22:23:05 +01:00
Vladimir 'phcoder' Serbinenko
2ae254de13 * grub-core/fs/affs.c (grub_affs_label): Interpret label as latin1. 2011-12-25 22:07:15 +01:00
Vladimir 'phcoder' Serbinenko
0108f49101 * grub-core/normal/menu.c (menu_init): Don't stop menu init at gfxterm. 2011-12-25 17:41:55 +01:00
Vladimir 'phcoder' Serbinenko
f45f5f89ff * unicode: Import Unicode 6.0 data. 2011-12-25 16:17:25 +01:00
Vladimir 'phcoder' Serbinenko
63fa8ef94e * grub-core/term/gfxterm.c (grub_gfxterm_putchar): Don't set values
outside of range.
2011-12-25 16:15:01 +01:00
Vladimir 'phcoder' Serbinenko
4d8c476536 Avoid cutting in the middle of UTF-8 string.
* include/grub/charset.h (grub_getend): New function.
	* grub-core/script/function.c (grub_script_function_find): Use
	grub_getend.
	* grub-core/normal/completion.c (add_completion): Likewise.
2011-12-25 16:11:41 +01:00
Vladimir 'phcoder' Serbinenko
f3cb4a4e57 * grub-core/normal/charset.c (grub_ucs4_to_utf8): Small stylistic fix.
(grub_bidi_line_logical_to_visual): Skip tags. They are deprecated.
	* include/grub/unicode.h (GRUB_UNICODE_TAG_START): New enum value.
	(GRUB_UNICODE_TAG_END): Likewise.
	(GRUB_UNICODE_LAST_VALID): Likewise.
2011-12-25 16:07:33 +01:00
Vladimir 'phcoder' Serbinenko
5da8dbc5bc * include/grub/unicode.h (grub_unicode_compact_range): Replace end with
len and make it smaller. All users updated.
	* util/import_unicode.py: Put length and not end character.
	Check length.
2011-12-25 16:03:42 +01:00
Vladimir 'phcoder' Serbinenko
8569f13d8d Make better Unicode-compliant and unify some UTF-8 code pathes.
* grub-core/normal/charset.c (grub_utf8_to_utf16): Don't eat possibly
	valid character.
	(grub_is_valid_utf8): Use grub_utf8_process.
	Check resulting code range.
	(grub_utf8_to_ucs4): Use grub_utf8_process.
	* include/grub/charset.h (grub_utf16_to_utf8): Don't eat up a possibly
	valid character.
2011-12-25 15:57:50 +01:00
Vladimir 'phcoder' Serbinenko
cc4fddf5f5 * grub-core/io/bufio.c (grub_bufio_read): Fix handling of corner cases. 2011-12-25 15:43:15 +01:00
Vladimir 'phcoder' Serbinenko
bbc47747ad * docs/grub.texi (Filesystems): Mention AFS. 2011-12-25 15:40:43 +01:00
Vladimir 'phcoder' Serbinenko
f63d6bf4a1 * docs/grub.texi (Filesystems): Clarify restrictions.
(Regexp): Mention non-Unicode regexp behaviour.
	(Other): Mention non-Unicode matching behaviour.
2011-12-25 14:46:44 +01:00
Vladimir 'phcoder' Serbinenko
74bbf0dbae Make HFS implementation use MacRoman.
* grub-core/fs/hfs.c (MAX_UTF8_PER_MAC_ROMAN): New define.
	(macroman): New const array.
	(macroman_to_utf8): New function.
	(utf8_to_macroman): Likewise.
	(grub_hfs_find_dir): Use utf8_to_macroman.
	(grub_hfs_dir): Use macroman_to_utf8.
	Set case_insensitive.
2011-12-24 20:20:41 +01:00
Vladimir 'phcoder' Serbinenko
4ea0316e67 * docs/grub.texi (Filesystems): Add IEEE1275 full-path example. 2011-12-24 15:38:53 +01:00
Vladimir 'phcoder' Serbinenko
d3c13cbd62 Integrate hints into autogeneration scripts.
* docs/grub.texi (Filesystems): Add a hostdisk example.
	* Makefile.util.def (grub-mkdevicemap): Remove ofpath.
	(grub-probe): Add ofpath.
	* gentpl.py: Remove group nosparc64.
	* grub-core/commands/search.c (cache_entry): New struct.
	(cache): New var.
	(FUNC_NAME): Use and save cache. Fix handling of trailing comma.
	* grub-core/commands/search_wrap.c (options): Add platform-specific
	hint options.
	(grub_cmd_search): Handle platform-specific hints.
	(GRUB_MOD_INIT): Declare grub_cmd_search as accept_dash.
	* grub-core/kern/emu/hostdisk.c (map): New field device_map.
	(grub_util_biosdisk_data): Likewise.
	(grub_util_biosdisk_open): Set device_map.
	(read_device_map): Handle "" as indication of no map.
	Set device_map.
	(find_system_device): Add hostdisk/ prefix for autogenerated entries.
	(grub_util_biosdisk_get_compatibility_hint): New function.
	* grub-core/normal/main.c (features): Add feature_platform_search_hint.
	* include/grub/emu/hostdisk.h
	(grub_util_biosdisk_get_compatibility_hint): New proto.
	* util/grub-install.in: Don't call grub-mkdevicemap.
	Add platform-specific hint to load.cfg.
	* util/grub-mkconfig.in: Don't call grub-mkdevicemap.
	* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Add
	hints. Set root preliminary to compatibility hint, not to OS name.
	* util/grub-probe.c (PRINT_*): Add hints.
	(print): Make static.
	(escape_of_path): New function.
	(guess_bios_drive): Likewise.
	(guess_efi_drive): Likewise.
	(guess_baremetal_drive): Likewise.
	(print_full_name): Likewise.
	(probe): Handle hints.
	(main): Likewise.
	* util/ieee1275/devicemap.c: Removed.
	* util/ieee1275/ofpath.c (find_obppath): Allow to fail. All users
	updated.
	(grub_util_devname_to_ofpath): Return NULL on failure.

	* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Fix
	resource leak.
	* util/getroot.c (grub_util_pull_device): Fix memory leak.

	* po/POTFILES.in: Regenerated.

	Allow purely long options

	* grub-core/lib/arg.c (SHORT_ARG_HELP): Removed.
	(SHORT_ARG_USAGE): Likewise.
	(grub_arg_show_help): Compare opt with help_options.
	(parse_option): Receive opt as argument. If makes big simplificatons.
	All users updated
2011-12-24 15:09:26 +01:00
Vladimir 'phcoder' Serbinenko
a141ef409f Put recheck back 2011-12-24 13:37:28 +01:00
Vladimir 'phcoder' Serbinenko
00ce2df3d4 * grub-core/lib/libgcrypt_wrap/cipher_wrap.h (WORDS_BIGENDIAN):
Restructure to avoid warning.
2011-12-24 13:12:01 +01:00
Vladimir 'phcoder' Serbinenko
93d0a00116 Fix IEEE1275 bugs in grub-probe 2011-12-24 02:54:28 +01:00
Vladimir 'phcoder' Serbinenko
2b5c1a0810 merge mainline into hints 2011-12-24 02:52:43 +01:00
Vladimir 'phcoder' Serbinenko
e77e325f6f * util/grub-install.in: Account for possible escaped comma in device
name.
2011-12-24 02:50:30 +01:00
Vladimir 'phcoder' Serbinenko
165099ea42 * util/ieee1275/ofpath.c (of_path_of_ide): Fix address for secondary
channel.
2011-12-24 02:46:47 +01:00
Vladimir 'phcoder' Serbinenko
ce4a999d4d * grub-core/kern/ieee1275/openfw.c (grub_devalias_iterate): Fix
allocation and zero-setting.
	(grub_ieee1275_get_devname): Check that alias is complete.
2011-12-24 02:45:17 +01:00
Vladimir 'phcoder' Serbinenko
379586ad7d * grub-core/kern/disk.c (grub_disk_read): Fix hook calling for
unaligned segments.
2011-12-24 02:43:21 +01:00
Vladimir 'phcoder' Serbinenko
9197b0ade5 * grub-core/disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Add ieee1275/
prefix.
	(grub_ofdisk_open): Check and discard ieee1275 prefix.
	* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_encode_devname):
	Add ieee1275 prefix.
2011-12-24 02:40:18 +01:00
Vladimir 'phcoder' Serbinenko
f4d5a8ce56 search cache 2011-12-23 21:14:34 +01:00
Vladimir 'phcoder' Serbinenko
706c46bdca Fix *end restoring 2011-12-23 21:14:24 +01:00
Vladimir 'phcoder' Serbinenko
aa68ca1250 simplify lib/arg.c and allow purely long options 2011-12-23 21:13:09 +01:00
Vladimir 'phcoder' Serbinenko
2980502850 Fix few bugs and memory leaks 2011-12-23 19:25:24 +01:00