nvme-fabrics: Use scnprintf() for avoiding potential buffer overflow
authorTakashi Iwai <tiwai@suse.de>
Wed, 11 Mar 2020 08:50:37 +0000 (09:50 +0100)
committerKeith Busch <kbusch@kernel.org>
Wed, 25 Mar 2020 19:51:55 +0000 (04:51 +0900)
commit8d8a50e20dc2dc41cb788085968b9024dc36f7a5
treecaa01ad16a92349a4344da6e114f49cb484a970f
parent764e9332098c0e60251386a507fe46ac91276120
nvme-fabrics: Use scnprintf() for avoiding potential buffer overflow

Since snprintf() returns the would-be-output size instead of the
actual output size, the succeeding calls may go beyond the given
buffer limit.  Fix it by replacing with scnprintf().

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/fabrics.c