]> Git Repo - qemu.git/commit - nbd/client.c
nbd/client: Correctly handle bad server REP_META_CONTEXT
authorEric Blake <[email protected]>
Thu, 29 Mar 2018 23:18:37 +0000 (18:18 -0500)
committerEric Blake <[email protected]>
Mon, 2 Apr 2018 13:59:34 +0000 (08:59 -0500)
commit260e34dbb7646b23d6f93bb5f2b208acf60f1088
tree99de0e530762580e456d122ac785a684042f820a
parent00d96a4612f81e82c181fe821d527e98abcbac07
nbd/client: Correctly handle bad server REP_META_CONTEXT

It's never a good idea to blindly read for size bytes as
returned by the server without first validating that the size
is within bounds; a malicious or buggy server could cause us
to hang or get out of sync from reading further messages.

It may be smarter to try and teach the client to cope with
unexpected context ids by silently ignoring them instead of
hanging up on the server, but for now, if the server doesn't
reply with exactly the one context we expect, it's easier to
just give up - however, if we give up for any reason other
than an I/O failure, we might as well try to politely tell
the server we are quitting rather than continuing.

Fix some typos in the process.

Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20180329231837.1914680[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
nbd/client.c
This page took 0.026632 seconds and 4 git commands to generate.