ipr: Fix out-of-bounds null overwrite
authorInsu Yun <wuninsu@gmail.com>
Wed, 6 Jan 2016 17:44:01 +0000 (12:44 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 1 Apr 2016 00:54:35 +0000 (01:54 +0100)
commitcaf4c8db59e82f8bc3ed516e25d32f488c7db868
treee5df82e4c52efefcf031b742dec9291b23bd31bc
parent2d5a6d0db3c83f5883b542fd3f79a2a80d319b14
ipr: Fix out-of-bounds null overwrite

commit d63c7dd5bcb9441af0526d370c43a65ca2c980d9 upstream.

Return value of snprintf is not bound by size value, 2nd argument.
(https://www.kernel.org/doc/htmldocs/kernel-api/API-snprintf.html).
Return value is number of printed chars, can be larger than 2nd
argument.  Therefore, it can write null byte out of bounds ofbuffer.
Since snprintf puts null, it does not need to put additional null byte.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Reviewed-by: Shane Seymour <shane.seymour@hpe.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/scsi/ipr.c