[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] common/vsprintf: Explicitly treat negative lengths as 'unlimited'
commit 034a5199c620596c9fc95a8cb7de122a922dc428 Author: Tim Deegan <tim@xxxxxxx> AuthorDate: Thu Nov 28 14:33:06 2013 +0000 Commit: Tim Deegan <tim@xxxxxxx> CommitDate: Thu Mar 6 10:12:38 2014 +0000 common/vsprintf: Explicitly treat negative lengths as 'unlimited' The old code relied on implictly casting negative numbers to size_t making a very large limit, which was correct but non-obvious. Coverity CID 1128575 Signed-off-by: Tim Deegan <tim@xxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> --- xen/common/vsprintf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c index f7cb0f1..8c43282 100644 --- a/xen/common/vsprintf.c +++ b/xen/common/vsprintf.c @@ -240,7 +240,7 @@ static char *number( static char *string(char *str, char *end, const char *s, int field_width, int precision, int flags) { - int i, len = strnlen(s, precision); + int i, len = (precision < 0) ? strlen(s) : strnlen(s, precision); if (!(flags & LEFT)) { while (len < field_width--) { -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |