From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] common/vsprintf: fix return value when formatting symbolic addresses Date: Mon, 02 Dec 2013 15:23:36 +0000 Message-ID: References: <529C8611.6060301@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VnVLf-0006Ym-Kf for xen-devel@lists.xenproject.org; Mon, 02 Dec 2013 15:23:47 +0000 Received: by mail-ea0-f173.google.com with SMTP id g15so9171627eak.18 for ; Mon, 02 Dec 2013 07:23:46 -0800 (PST) In-Reply-To: <529C8611.6060301@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper , Jan Beulich Cc: xen-devel List-Id: xen-devel@lists.xenproject.org On 02/12/2013 13:07, "Andrew Cooper" wrote: > On 02/12/13 12:06, Jan Beulich wrote: >> When the buffer to be formatted to is too small, the function return >> value is expected to be the number of characters that would be printed >> (particularly important if that value is then used for allocating a >> buffer). Hence incrementing the active pointer must always be >> independent of actually storing a character. >> >> Signed-off-by: Jan Beulich > > Reviewed-by: Andrew Cooper Acked-by: Keir Fraser >> >> --- a/xen/common/vsprintf.c >> +++ b/xen/common/vsprintf.c >> @@ -294,6 +294,7 @@ static char *pointer(char *str, char *en >> /* Print '+/' */ >> str = number(str, end, sym_offset, 16, -1, -1, >> SPECIAL|SIGN|PLUS); >> if ( str <= end ) >> - *str++ = '/'; >> + *str = '/'; >> + ++str; >> str = number(str, end, sym_size, 16, -1, -1, SPECIAL); >> } >> >> >> >> > >