summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2016-11-18 11:35:01 -0700
committerMartin Roth <martinroth@google.com>2016-11-21 23:44:18 +0100
commitad6c885ce48edeb0120499c0877e3145080a901e (patch)
treebe36ac6e1116edb9689d185d3e90997b5cbf3a16
parent128c104c4d3b91d3371b03840af460d776af819d (diff)
console/vtxprintf.c: cast precision to size_t for string length
If no maximum string length is specified, we're intentionally passing a value of -1 to get the string length so that it's not limited. This makes checking tools unhappy, so actively cast it to size_t before passing it into strlen to show that it's not an accident. Addresses coverity issue 1129133 - Argument cannot be negative Change-Id: I40f8f2101e170a5c96fcd39c217aa414f4316473 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/17479 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r--src/console/vtxprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/console/vtxprintf.c b/src/console/vtxprintf.c
index d20a387d44..5f37253e7d 100644
--- a/src/console/vtxprintf.c
+++ b/src/console/vtxprintf.c
@@ -228,7 +228,7 @@ repeat:
if (!s)
s = "<NULL>";
- len = strnlen(s, precision);
+ len = strnlen(s, (size_t)precision);
if (!(flags & LEFT))
while (len < field_width--)