summary refs log tree commit diff stats
path: root/exec.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2018-03-29 18:18:37 -0500
committerEric Blake <eblake@redhat.com>2018-04-02 08:59:34 -0500
commit260e34dbb7646b23d6f93bb5f2b208acf60f1088 (patch)
tree99de0e530762580e456d122ac785a684042f820a /exec.c
parent00d96a4612f81e82c181fe821d527e98abcbac07 (diff)
downloadfocaccia-qemu-260e34dbb7646b23d6f93bb5f2b208acf60f1088.tar.gz
focaccia-qemu-260e34dbb7646b23d6f93bb5f2b208acf60f1088.zip
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 <eblake@redhat.com>
Message-Id: <20180329231837.1914680-1-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'exec.c')
0 files changed, 0 insertions, 0 deletions