]> git.baikalelectronics.ru Git - kernel.git/commit
9p: p9dirent_read: check network-provided name length
authorDominique Martinet <dominique.martinet@cea.fr>
Fri, 7 Sep 2018 15:36:08 +0000 (00:36 +0900)
committerDominique Martinet <dominique.martinet@cea.fr>
Fri, 7 Sep 2018 16:52:29 +0000 (01:52 +0900)
commit0f7ded3a2847e35c281e60b3796f4bf993f20eef
treef03d8d9e65bd3c3cec20f5a2e889d859265f87b0
parent09e6fedc7cf7f0286fb19c5add2cd5dfa846d42f
9p: p9dirent_read: check network-provided name length

strcpy to dirent->d_name could overflow the buffer, use strscpy to check
the provided string length and error out if the size was too big.

While we are here, make the function return an error when the pdu
parsing failed, instead of returning the pdu offset as if it had been a
success...

Link: http://lkml.kernel.org/r/1536339057-21974-4-git-send-email-asmadeus@codewreck.org
Addresses-Coverity-ID: 139133 ("Copy into fixed size buffer")
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
net/9p/protocol.c