diff options
author | Eric Blake <eblake@redhat.com> | 2018-03-29 18:18:37 -0500 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2018-04-02 08:59:34 -0500 |
commit | 260e34dbb7646b23d6f93bb5f2b208acf60f1088 (patch) | |
tree | 99de0e530762580e456d122ac785a684042f820a /scsi/utils.c | |
parent | 00d96a4612f81e82c181fe821d527e98abcbac07 (diff) |
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 'scsi/utils.c')
0 files changed, 0 insertions, 0 deletions