USB: yurex: Fix buffer over-read in yurex_write()
authorBen Hutchings <ben.hutchings@codethink.co.uk>
Wed, 15 Aug 2018 20:44:25 +0000 (21:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Sep 2018 11:27:06 +0000 (13:27 +0200)
commit7e10f14ebface44a48275c8d6dc1caae3668d5a9
treea6d69dbcdb3c191be3bb6017a90a01ff2584ab75
parent222471f7640d9771a993218d825d84825adc805d
USB: yurex: Fix buffer over-read in yurex_write()

If the written data starts with a digit, yurex_write() tries to parse
it as an integer using simple_strtoull().  This requires a null-
terminator, and currently there's no guarantee that there is one.

(The sample program at
https://github.com/NeoCat/YUREX-driver-for-Linux/blob/master/sample/yurex_clock.pl
writes an integer without a null terminator.  It seems like it must
have worked by chance!)

Always add a null byte after the written data.  Enlarge the buffer
to allow for this.

Cc: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/yurex.c