mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: 徐永健 <xuyongjiande@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [BUG] Buffer Overflow in drivers/video/fbmem.c
Date: Thu, 26 Sep 2013 14:14:36 -0700	[thread overview]
Message-ID: <20130926141436.6eec4671868526dbf15238da@linux-foundation.org> (raw)
In-Reply-To: <CABVvea3mENMUqUtb2OGUN+vXqMVPVEgtna4w56gT1dh7gh7r7Q@mail.gmail.com>

On Mon, 23 Sep 2013 19:32:04 +0800 _________ <xuyongjiande@gmail.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.



      reply	other threads:[~2013-09-26 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23 11:32 徐永健
2013-09-26 21:14 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130926141436.6eec4671868526dbf15238da@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xuyongjiande@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®