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)
commitef5305f1f72eb1cfcda25c382bb0368509c0385b
treef03d8d9e65bd3c3cec20f5a2e889d859265f87b0
parent473c7dd1d7b59ff8f88a5154737e3eac78a96e5b
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