]> git.karo-electronics.de Git - karo-tx-linux.git/commit
sscanf: don't ignore field widths for numeric conversions
authorJan Beulich <JBeulich@suse.com>
Fri, 9 Nov 2012 03:04:52 +0000 (14:04 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 12 Nov 2012 04:17:22 +0000 (15:17 +1100)
commit3062d049edf4edf4bb9d34b5049d503176e5f5ba
treedb23760198f57e43b800fd9fc4b04531a36e16d3
parent4ae293ac5f55e0125d686be0ffb010bf231bb1cb
sscanf: don't ignore field widths for numeric conversions

This is another step towards better standard conformance.  Rather than
adding a local buffer to store the specified portion of the string (with
the need to enforce an arbitrary maximum supported width to limit the
buffer size), do a maximum width conversion and then drop as much of it as
is necessary to meet the caller's request.

Also fail on negative field widths.

Uses the deprecated simple_strto*() functions because kstrtoXX() fail on
non-zero terminated strings.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/vsprintf.c