From: Al Viro <viro@ZenIV.linux.org.uk>
To: Chen Gang <gang.chen@asianux.com>
Cc: George Spelvin <linux@horizon.com>,
reiserfs-devel@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] reiserfs: check/extend buffer length for printing functions
Date: Thu, 18 Jul 2013 08:43:17 +0100 [thread overview]
Message-ID: <20130718074316.GY4165@ZenIV.linux.org.uk> (raw)
In-Reply-To: <51E7994D.1060300@asianux.com>
On Thu, Jul 18, 2013 at 03:29:17PM +0800, Chen Gang wrote:
> On 07/18/2013 12:28 PM, Chen Gang wrote:
> >
> >> strcpy(fmt1, fmt);
> >> @@ -199,46 +214,51 @@ static void prepare_error_buf(const char *fmt, va_list args)
> >> while ((k = is_there_reiserfs_struct(fmt1, &what)) != NULL) {
> >> *k = 0;
> >>
> >> - p += vsprintf(p, fmt1, args);
> >> + p += vsnprintf(p, left, fmt1, args);
>
> At least, need use vscnprintf() instead of vsnprintf(), since we need
> the real written length return.
n = vsnprintf(p, left, ....);
left -= n;
if (left <= 0) /* overflow */
break; /* or whatever's suitable here */
p += n;
next prev parent reply other threads:[~2013-07-18 7:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 8:48 [PATCH] reiserfs: check/extend buffer length for printing functions Chen Gang
2013-07-18 4:28 ` Chen Gang
2013-07-18 7:29 ` Chen Gang
2013-07-18 7:43 ` Al Viro [this message]
2013-07-18 7:54 ` Chen Gang
2013-07-18 8:18 ` Chen Gang
2013-07-19 4:07 ` Chen Gang
2013-07-19 4:19 ` [PATCH v2] " 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=20130718074316.GY4165@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=gang.chen@asianux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@horizon.com \
--cc=reiserfs-devel@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