]> www.infradead.org Git - users/jedix/linux-maple.git/commit
vsnprintf: fix the number base for non-numeric formats
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 13 Jan 2025 16:23:28 +0000 (08:23 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 13 Jan 2025 16:23:28 +0000 (08:23 -0800)
commitecdc475e0707c98c2a89da8d0024b3ea2924ef9b
tree04496bde613c09d35f9c0370ea3e39235300c450
parentfa47906ff358a5865b7be2356a5a1d1e58dd17d8
vsnprintf: fix the number base for non-numeric formats

Commit 8d4826cc8a8a ("vsnprintf: collapse the number format state into
one single state") changed the format specification decoding to be a bit
more straightforward but in the process ended up also resetting the
number base to zero for formats that aren't clearly numerical.

Now, the number base obviously doesn't matter for something like '%s',
so this wasn't all that obvious.  But some of our specialized pointer
extension formatting (ie, things like "print out IPv6 address") did up
depending on the default base-10 setting, and when they then tried to
print out numbers in "base zero", things didn't work out so well.

Most pointer formatting (including things like the default raw hex value
conversion) didn't have this issue, because they used helpers that
explicitly set the base.

Reported-and-tested-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202501131352.e226f995-lkp@intel.com
Fixes: 8d4826cc8a8a ("vsnprintf: collapse the number format state into one single state")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/vsprintf.c