Re: [PATCH] fsck.minix: Verify more fields in super-block.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 29, 2016 at 06:56:58PM +0200, Tobias Stoeckmann wrote:

Applied, thanks.

> diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
> index aa64569..931658f 100644
> --- a/disk-utils/fsck.minix.c
> +++ b/disk-utils/fsck.minix.c
> @@ -573,8 +573,12 @@ read_superblock(void) {
>  		die(_("bad magic number in super-block"));
>  	if (get_zone_size() != 0 || MINIX_BLOCK_SIZE != 1024)
>  		die(_("Only 1k blocks/zones supported"));
> +	if (get_ninodes() == 0 || get_ninodes() == UINT32_MAX)
> +		die(_("bad s_ninodes field in super-block"));
>  	if (get_nimaps() * MINIX_BLOCK_SIZE * 8 < get_ninodes() + 1)
>  		die(_("bad s_imap_blocks field in super-block"));
> +	if (get_first_zone() > get_nzones())
> +		die(_("bad s_firstdatazone field in super-block"));

   if (get_first_zone() > (off_t) get_nzones())

seems better to keep compiler happy :-)

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux