]> www.infradead.org Git - users/sagi/libnvme.git/commit
fabrics: fix potential invalid memory access in __nvmf_supported_option()
authorMaurizio Lombardi <mlombard@redhat.com>
Mon, 8 May 2023 15:47:00 +0000 (17:47 +0200)
committerDaniel Wagner <wagi@monom.org>
Mon, 8 May 2023 16:17:57 +0000 (18:17 +0200)
commitf7ba8bf447d44ac6b58fa0e41e58967754881897
treef2a2a1a66d91caedddc7f5937dfec82ec0430257
parent2aaf2edccb5580890d5bc69d4d443584e430343a
fabrics: fix potential invalid memory access in __nvmf_supported_option()

In __nvmf_supported_option(), len is declared as size_t (unsigned)

"len = read()" may return a negative number;
the check "if (len < 0)" will always be false and therefore
"buf[len]" will dereference an invalid memory address.

len should be declared as a signed size_t (ssize_t)

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
src/nvme/fabrics.c