From 37077bfe36842f897752998c94f1587dba43a7ce Mon Sep 17 00:00:00 2001 From: Peter Stuge Date: Thu, 19 Mar 2009 13:34:53 +0000 Subject: v3 vtxprintf(): Stop looking for non-ASCII characters after one has been found. And update the string length. Many thanks to Mathias Krause for spotting this! Signed-off-by: Peter Stuge Acked-by: Peter Stuge git-svn-id: svn://coreboot.org/repository/coreboot-v3@1159 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- lib/vtxprintf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/vtxprintf.c b/lib/vtxprintf.c index bc3621b91b0d..8a95ca1ec410 100644 --- a/lib/vtxprintf.c +++ b/lib/vtxprintf.c @@ -202,8 +202,11 @@ int vtxprintf(void (*tx_byte)(unsigned char byte, void *arg), void *arg, const c len = strnlen(s, precision); for (i = 0; i < len; ++i) - if (!isprint(*s[i])) + if (!isprint(*s[i])) { s = ""; + len = strlen(s); + break; + } if (!(flags & LEFT)) while (len < field_width--) tx_byte(' ', arg), count++; -- cgit v1.2.3