]> git.karo-electronics.de Git - karo-tx-linux.git/commit
lib/vsprintf.c: also improve sanity check in bstr_printf()
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Wed, 21 Oct 2015 22:03:50 +0000 (09:03 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 Oct 2015 22:03:50 +0000 (09:03 +1100)
commitd906a3e6df33afea349579efde77f077922fef67
treeb41c287b8b12e22277a4137b498dd3be1eaf75c4
parent99fe02fd86ff80279a3b728813038659bacd8d21
lib/vsprintf.c: also improve sanity check in bstr_printf()

Quoting from 2aa2f9e21e4e ("lib/vsprintf.c: improve sanity check in
vsnprintf()"):

    On 64 bit, size may very well be huge even if bit 31 happens to be 0.
    Somehow it doesn't feel right that one can pass a 5 GiB buffer but not a
    3 GiB one.  So cap at INT_MAX as was probably the intention all along.
    This is also the made-up value passed by sprintf and vsprintf.

I should have seen this copy-pasted instance back then, but let's just
do it now.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Martin Kletzander <mkletzan@redhat.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/vsprintf.c