[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] common/vsprintf: fix return value when formatting symbolic addresses



commit fd62e281dfe6183cd140cf2cf2bca1a10b574aa7
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Dec 3 09:57:41 2013 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Dec 3 09:57:41 2013 +0100

    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@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Keir Fraser <keir@xxxxxxx>
---
 xen/common/vsprintf.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c
index 43dc392..1a6198e 100644
--- a/xen/common/vsprintf.c
+++ b/xen/common/vsprintf.c
@@ -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);
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.