_scanf.c: Implement 'm' modifier for 'c' and '[' conversions.
commitfe7d30e6337f280a451ac057f47d48349b63e462
authorWill Newton <will.newton@imgtec.com>
Thu, 7 May 2015 22:15:19 +0000 (8 01:15 +0300)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Wed, 20 May 2015 08:59:30 +0000 (20 10:59 +0200)
tree1a52a7026f4929c89adf75d8a7916293eab5fff2
parentbfbcc35b0ff8e40570a99872fd538e344d8c7f75
_scanf.c: Implement 'm' modifier for 'c' and '[' conversions.

The current code implements the 'm' modifier only for 's'
conversions and would cause a segfault if it was used for 'c'
or '[' conversions. This patch extends the code to cover these
cases too.

The original version could write scanned data outside the passed buffer
because index i used in the '[' conversion handling block was clobbered.

Signed-off-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
libc/stdio/_scanf.c
test/stdio/scanf_m.c [new file with mode: 0644]