From: ben@fluff.org (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
Date: Mon, 21 Jan 2013 13:56:26 +0000 [thread overview]
Message-ID: <20130121135626.GP1095@trinity.fluff.org> (raw)
In-Reply-To: <50FD178E.9090105@asianux.com>
On Mon, Jan 21, 2013 at 06:25:18PM +0800, Chen Gang wrote:
>
> the buff size is 256, so need use vsnprintf instead of vsprintf.
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
> arch/arm/plat-samsung/pm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
> index 1507028..8d07b45 100644
> --- a/arch/arm/plat-samsung/pm.c
> +++ b/arch/arm/plat-samsung/pm.c
> @@ -51,7 +51,7 @@ void s3c_pm_dbg(const char *fmt, ...)
> char buff[256];
>
> va_start(va, fmt);
> - vsprintf(buff, fmt, va);
> + vsnprintf(buff, 256, fmt, va);
How about: vsnprintf(buff, sizeof(buff), fmt, va);
It means we do not end up assuming the size of 'buff' and will be correct
if the code is changed to declare 'buff' to be a different size.
--
Ben Dooks, ben at fluff.org, http://www.fluff.org/ben/
Large Hadron Colada: A large Pina Colada that makes the universe disappear.
next prev parent reply other threads:[~2013-01-21 13:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-21 10:25 [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256 Chen Gang
2013-01-21 13:56 ` Ben Dooks [this message]
2013-01-22 1:00 ` Chen Gang
2013-01-21 16:00 ` Russell King - ARM Linux
2013-01-22 1:00 ` Chen Gang
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=20130121135626.GP1095@trinity.fluff.org \
--to=ben@fluff.org \
--cc=linux-arm-kernel@lists.infradead.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).