Skip to content

lib/vsprintf:

Masami Hiramatsu (Google) lkml 1 version In review

Get series with b4
b4 am 177397870465.32028.16886163523113776879.stgit@devnote2

Versions newest first

  1. v1 Latest0 of 1 patch 1 replyIn review

Patches in v1 No applies recorded yet

The patch the cover letter announces is not in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] lib/vsprintf: Fixes size check

Hi,

Here is a pair of patches to fix vsnprintf().

- Fix to limit the size of width and precision.
- Warn if the return size is over INT_MAX.

Recently we discussed snprintf() usage in bootconfig and found snprintf() design has a problem[1]. It returns the required or printed size in 'int' but the maxlen is passed by 'size_t'. The maxlen is already limited by INT_MAX, but if the expected print size becomes bigger than INT_MAX, it can return negative value. We also found width and precision size check does not work.

[1] https://lore.kernel.org/all/[email protected]/

Thank you,

---

Masami Hiramatsu (Google) (2):
lib/vsprintf: Fix to check field_width and precision lib/vsprintf: Limit the returning size to INT_MAX

 lib/vsprintf.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--
Masami Hiramatsu (Google) <[email protected]>