All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Al Viro <viro@zeniv.linux.org.uk>, George Spelvin <linux@horizon.com>
Cc: 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 15:29:17 +0800	[thread overview]
Message-ID: <51E7994D.1060300@asianux.com> (raw)
In-Reply-To: <51E76ED7.303@asianux.com>

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.

>> +		left = REISERFS_ERR_BUF_LEFT(p, error_buf);
>>  
>>  		switch (what) {
>>  		case 'k':
>> -			sprintf_le_key(p, va_arg(args, struct reiserfs_key *));
>> +			sprintf_le_key(p, left,
>> +				       va_arg(args, struct reiserfs_key *));
>>  			break;
>>  		case 'K':
>> -			sprintf_cpu_key(p, va_arg(args, struct cpu_key *));
>> +			sprintf_cpu_key(p, left,
>> 


-- 
Chen Gang

  reply	other threads:[~2013-07-18  7:29 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 [this message]
2013-07-18  7:43     ` Al Viro
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=51E7994D.1060300@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.