Skip to content

Commit f7ba8bf

Browse files
maurizio-lombardiigaw
authored andcommitted
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 <[email protected]>
1 parent 2aaf2ed commit f7ba8bf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/nvme/fabrics.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ static int __nvmf_supported_options(nvme_root_t r)
625625
{
626626
char buf[0x1000], *options, *p, *v;
627627
int fd, ret;
628-
size_t len;
628+
ssize_t len;
629629

630630
if (r->options)
631631
return 0;

0 commit comments

Comments
 (0)