[Top][All Lists]

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

Re: HFS endianness

From: Colin Watson
Subject: Re: HFS endianness
Date: Tue, 11 Aug 2009 00:54:57 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, Aug 11, 2009 at 01:15:54AM +0200, Vladimir 'phcoder' Serbinenko wrote:
> Hello I was looking which FS were little and which are big-endian.
> This attracted my attention in hfs.c:
>   /* Adjust len so it we can't read past the end of the file.  */
>   if (len > grub_le_to_cpu32 (data->size))
>     len = grub_le_to_cpu32 (data->size);
> Which looks suspicious for big-endian FS. Can anyone check? If note
> this mail will be note to self

data->size is initialised using grub_be_to_cpu32 (frec.size) in
grub_hfs_open. It looks fairly clearly incorrect for it to be converted
again; AFAICS that code will only work properly on little-endian CPUs.
This looks as if it ought to be better, although I'm not really in a
position to test it:

  if (len > data->size)
    len = data->size;

Colin Watson                                       address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]