common/vsprintf: fix return value when formatting symbolic addresses

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 <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
This commit is contained in:
Jan Beulich committed 2013-12-03 09:57:41 +01:00
1 parent a5ca03ea2f
commit fd62e281df
1 file changed
+2 -1
+2 -1
View File
@@ -294,7 +294,8 @@ static char *pointer(char *str, char *end, const char **fmt_ptr,
/* Print '+<offset>/<len>' */
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);
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.