[syslinux] [PATCH] add additional checks to ext2 loader

Frediano Ziglio frediano.ziglio at citrix.com
Wed Oct 10 06:12:17 PDT 2012


Yes, it's ok for me!

Acknowledge!

Frediano


On Wed, 2012-10-10 at 11:05 +0100, Matt Fleming wrote:
> On Tue, 2012-10-09 at 14:32 -0300, Paulo Alcantara wrote:
> > From: Frediano Ziglio <frediano.ziglio at citrix.com>
> > Date: Thu, 2 Aug 2012 09:32:36 +0100
> > 
> > >      e_inode = ext2_get_inode(fs, inr);
> > > -    if (!(inode = alloc_inode(fs, inr, sizeof(struct ext2_pvt_inode))))
> > > +    if (!e_inode || !(inode = alloc_inode(fs, inr, sizeof(struct ext2_pvt_inode))))
> > >  	return NULL;
> > 
> > You could at least refactor this. This if-statement is just horrible and hard to
> > read at glance.
> 
> Guys, below is the commit I've merged. Does it look OK to both of you?
> Frediano, note that you are still listed as the author.
> 
> From e45f3540ae7a6298f27d77d1273375a3d765ca38 Mon Sep 17 00:00:00 2001
> From: Frediano Ziglio <frediano.ziglio at citrix.com>
> Date: Thu, 2 Aug 2012 09:32:36 +0100
> Subject: [PATCH] ext2: add additional check to ext2 loader
> 
> Check if a pointer is NULL due to specifying an invalid inode group
> number.
> 
> Signed-off-by: Frediano Ziglio <frediano.ziglio at citrix.com>
> Signed-off-by: Matt Fleming <matt.fleming at intel.com>
> ---
>  core/fs/ext2/ext2.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/core/fs/ext2/ext2.c b/core/fs/ext2/ext2.c
> index 716670c..7988faa 100644
> --- a/core/fs/ext2/ext2.c
> +++ b/core/fs/ext2/ext2.c
> @@ -164,6 +164,9 @@ static struct inode *ext2_iget_by_inr(struct fs_info *fs, uint32_t inr)
>      struct inode *inode;
>  
>      e_inode = ext2_get_inode(fs, inr);
> +    if (!e_inode)
> +	return NULL;
> +
>      if (!(inode = alloc_inode(fs, inr, sizeof(struct ext2_pvt_inode))))
>  	return NULL;
>      fill_inode(inode, e_inode);
> -- 
> 1.7.11.4
> 





More information about the Syslinux mailing list