[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20130926141436.6eec4671868526dbf15238da@linux-foundation.org>
Date: Thu, 26 Sep 2013 14:14:36 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: 徐永健 <xuyongjiande@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [BUG] Buffer Overflow in drivers/video/fbmem.c
On Mon, 23 Sep 2013 19:32:04 +0800 _________ <xuyongjiande@...il.com> wrote:
> Hi,
> Buffer overflow found in drivers/video/fbmem.c.
> [Version]:Newest
>
> [Detail]:
> 1592 static int do_register_framebuffer(struct fb_info *fb_info)
> 1593 {
> 1594 | int i;
> 1595 | struct fb_event event;
> 1596 | struct fb_videomode mode;
> ........
> 1607 | num_registered_fb++;
> 1608 | for (i = 0 ; i < FB_MAX; i++) //******* i could be FB_MAX
> after loop *********/
> 1609 | | if (!registered_fb[i])
> 1610 | | | break;
> ........
>
> 1646 | fb_var_to_videomode(&mode, &fb_info->var);
> 1647 | fb_add_videomode(&mode, &fb_info->modelist);
> 1648 | registered_fb[i] = fb_info; // ****** Here will be a
> off-by-one overflow *******/
I don't think so. This test:
if (num_registered_fb == FB_MAX)
return -ENXIO;
guarantees that there is at least one empty entry in registered_fb[],
so `i' will never reach FB_MAX.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists