HFS endianness
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
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Quoted 8 lines · Vladimir 'phcoder' Serbinenko
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
Actualy this code has another bug it doesn't take 'pos' into account. Unfortunately same bug is present on several other FSes. I'll look through them and will send a patch
Quoted 6 lines
--
Regards
Vladimir 'phcoder' SerbinenkoPersonal git repository: http://repo.or.cz/w/grub2/phcoder.git
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Quoted 7 lines · Vladimir 'phcoder' Serbinenko
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;Signature · 1 line
Colin Watson [[email protected]]