From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: [patch] fbdev: fix snprintf() limit in show_bl_curve()
Date: Fri, 21 Aug 2015 09:53:52 +0000 [thread overview]
Message-ID: <20150821095352.GQ5610@mwanda> (raw)
In-Reply-To: <20150821085302.GE25369@mwanda>
On Fri, Aug 21, 2015 at 12:22:03PM +0300, Andy Shevchenko wrote:
> On Fri, 2015-08-21 at 11:53 +0300, Dan Carpenter wrote:
> > The limit should be "PAGE_SIZE - len" instead of PAGE_SIZE.
> >
>
> Besides that was in the original code, the problem still might happen
> when FB_BACKLIGHT_LEVELS is set to 171+ since snprintf() returns
> desired length. I suppose you would change this to check len on each
> iteration or change to scnprintf() if I get it correct.
>
Yeah, you're right.
If you pass a negative size to snprintf() it won't overflow, but it will
print an error. I will send a v2 and change it to scnprintf(). I don't
think we will have 171 levels so it's not worth adding the check?
regards,
dan carpenter
next prev parent reply other threads:[~2015-08-21 9:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 8:53 [patch] fbdev: fix snprintf() limit in show_bl_curve() Dan Carpenter
2015-08-21 9:22 ` Andy Shevchenko
2015-08-21 9:53 ` Dan Carpenter [this message]
2015-08-21 11:26 ` Andy Shevchenko
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=20150821095352.GQ5610@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-fbdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).