* grub-core/fs/romfs.c (grub_romfs_mount): Fix pointer comparison

overflow.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-13 23:15:56 +01:00
parent efc2616ee1
commit e7987e1b3b
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/romfs.c (grub_romfs_mount): Fix pointer comparison
overflow.
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com> 2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/squash4.c (grub_squash_inode): Fix field sizes. * grub-core/fs/squash4.c (grub_squash_inode): Fix field sizes.

View file

@ -112,7 +112,7 @@ grub_romfs_mount (grub_device_t dev)
if (err) if (err)
return NULL; return NULL;
for (ptr = sb.sb.label; (void *) ptr < (void *) (&sb + 1) for (ptr = sb.sb.label; (void *) ptr < (void *) (&sb + 1)
&& ptr < sb.d + grub_be_to_cpu32 (sb.sb.total_size); ptr++) && ptr - sb.d < (grub_ssize_t) grub_be_to_cpu32 (sb.sb.total_size); ptr++)
if (!*ptr) if (!*ptr)
break; break;
if ((void *) ptr == &sb + 1) if ((void *) ptr == &sb + 1)
@ -124,7 +124,7 @@ grub_romfs_mount (grub_device_t dev)
if (err) if (err)
return NULL; return NULL;
for (ptr = sb.d; (void *) ptr < (void *) (&sb + 1) for (ptr = sb.d; (void *) ptr < (void *) (&sb + 1)
&& ptr < sb.d + grub_be_to_cpu32 (sb.sb.total_size); ptr++) && ptr - sb.d < (grub_ssize_t) grub_be_to_cpu32 (sb.sb.total_size); ptr++)
if (!*ptr) if (!*ptr)
break; break;
} }