OSDN Git Service

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)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 14 Feb 2018 02:35:39 +0000 (21:35 -0500)
commit1683ce57f568c7c92d53e9234624a53554a29cd5
tree1010454f842fd744423801b10697d4b867f7e88d
parentf3767225021a48fc419d963559793e585da88b3d
scsi: qedi: Fix truncation of CHAP name and secret

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>
drivers/scsi/qedi/qedi_main.c