Skip to content
  • Eric Blake's avatar
    260e34db
    nbd/client: Correctly handle bad server REP_META_CONTEXT · 260e34db
    Eric Blake authored
    
    
    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: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20180329231837.1914680-1-eblake@redhat.com>
    Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    260e34db
    nbd/client: Correctly handle bad server REP_META_CONTEXT
    Eric Blake authored
    
    
    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: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20180329231837.1914680-1-eblake@redhat.com>
    Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Loading