scsi: qedi: Fix truncation of CHAP name and secret
authorAndrew Vasquez <andrew.vasquez@cavium.com>
Wed, 7 Feb 2018 16:12:35 +0000 (08:12 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 14:17:48 +0000 (16:17 +0200)
commit942cb7bd774ae1c66e79d2ae720c1e1eee5ba0be
tree62d2346be0951dfee9cd86fb887b053be408fdec
parenta9eb1e1031a075570468bc03c1b72fa0c2e22a69
scsi: qedi: Fix truncation of CHAP name and secret

[ Upstream commit 1683ce57f568c7c92d53e9234624a53554a29cd5 ]

The data in NVRAM is not guaranteed to be NUL terminated.  Since
snprintf expects byte-stream to accommodate null byte, the CHAP secret
is truncated.  Use sprintf instead of snprintf to fix the truncation of
CHAP name and secret.

Signed-off-by: Andrew Vasquez <andrew.vasquez@cavium.com>
Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Acked-by: Chris Leech <cleech@redhat.com>
Acked-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/qedi/qedi_main.c