diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2019-07-30 13:40:18 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-31 00:54:57 +0000 |
commit | bef4cc466bdca22eb2140c100f9704060c028315 (patch) | |
tree | cb5019f238ed805e82cf505f97ffb04cb5c2e0c6 /common/printf.c | |
parent | 0bbe9193b17f6d6057b3ff3cc12af262e417f459 (diff) | |
download | chrome-ec-bef4cc466bdca22eb2140c100f9704060c028315.tar.gz |
vprintf: fix handling % in the end of the format string
EC vprintf() implementation treats a single '%' character in the end
of the format string as a literal per cent character. This is a
special case, while processing it the terminated zero is getting lost.
This patch fixes the problem.
BRANCH=none
BUG=none
TEST=none
Change-Id: I9abea74072b56edfbbace988b0b7a6d1f7d8cd5f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1726739
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/printf.c')
-rw-r--r-- | common/printf.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/printf.c b/common/printf.c index e673c17baa..f3b912b5c1 100644 --- a/common/printf.c +++ b/common/printf.c @@ -87,6 +87,10 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context, if (c == '%' || c == '\0') { if (addchar(context, '%')) return EC_ERROR_OVERFLOW; + + if (c == '\0') + break; + continue; } |