diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2005-10-07 12:40:51 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2005-10-07 12:40:51 +0000 |
commit | 9d534054be07d430ae942f8773f7c1dc7401b7b7 (patch) | |
tree | df3c557eb5838d144a7904e8e4a5ba3a69e7287f | |
parent | 7b20d5db3921d27dd68633df895f8aa3fd2359cb (diff) |
Notes
-rw-r--r-- | sys/kern/subr_prf.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 446f80d4c749..8184c01c9766 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -505,7 +505,7 @@ kvprintf(char const *fmt, void (*func)(int, void*), void *arg, int radix, va_lis int cflag, hflag, jflag, tflag, zflag; int dwidth; char padc; - int retval = 0; + int stop = 0, retval = 0; num = 0; if (!func) @@ -522,7 +522,7 @@ kvprintf(char const *fmt, void (*func)(int, void*), void *arg, int radix, va_lis for (;;) { padc = ' '; width = 0; - while ((ch = (u_char)*fmt++) != '%') { + while ((ch = (u_char)*fmt++) != '%' || stop) { if (ch == '\0') return (retval); PCHAR(ch); @@ -789,6 +789,13 @@ number: default: while (percent < fmt) PCHAR(*percent++); + /* + * Since we ignore an formatting argument it is no + * longer safe to obey the remaining formatting + * arguments as the arguments will no longer match + * the format specs. + */ + stop = 1; break; } } |