From 377a66bc4067362fd2a3d4edbab865766f71f158 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 7 Jan 2003 18:17:18 +0000 Subject: [PATCH] Cast the integer read as the first argument for %b to an unsigned integer so it's value is not sign extended when assigned to the uintmax_t variable used internally by printf. For example, if bit 31 is set in the cpuid feature word, then %b would print out the initial value as a 16 character hexadecimal value. Now it only prints out an 8 character value. Reviewed by: bde --- sys/kern/subr_prf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 8e1c7b819943..5f299f95b771 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -560,7 +560,7 @@ reswitch: switch (ch = (u_char)*fmt++) { width = n; goto reswitch; case 'b': - num = va_arg(ap, int); + num = (u_int)va_arg(ap, int); p = va_arg(ap, char *); for (q = ksprintn(nbuf, num, *p++, NULL); *q;) PCHAR(*q--);