]> git.baikalelectronics.ru Git - kernel.git/commit
sscanf: don't ignore field widths for numeric conversions
authorJan Beulich <JBeulich@suse.com>
Tue, 18 Dec 2012 00:01:31 +0000 (16:01 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 18 Dec 2012 01:15:18 +0000 (17:15 -0800)
commitd953ba0b10c6cbb0cc82946dc26025c2d4e5b706
tree8555da83945aaba9291f0d9ff09d271043e36263
parentb5b97c0f378929e82317d83ed7bbb223663f5b35
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/vsprintf.c