From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] common/vsprintf: fix return value when formatting symbolic addresses Date: Mon, 2 Dec 2013 13:07:29 +0000 Message-ID: <529C8611.6060301@citrix.com> References: <529C85D50200007800108AE7@nat28.tlf.novell.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 1VnTEH-0002tX-0x for xen-devel@lists.xenproject.org; Mon, 02 Dec 2013 13:08:01 +0000 In-Reply-To: <529C85D50200007800108AE7@nat28.tlf.novell.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: Jan Beulich Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org 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 > > --- 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); > } > > > >