Skip to content
  • Eric Blake's avatar
    70fa99f4
    nbd/client: Add safety check on chunk payload length · 70fa99f4
    Eric Blake authored
    
    
    Our existing use of structured replies either reads into a qiov capped
    at 32M (NBD_CMD_READ) or caps allocation to 1000 bytes (see
    NBD_MAX_MALLOC_PAYLOAD in block/nbd.c).  But the existing length
    checks are rather late; if we encounter a buggy (or malicious) server
    that sends a super-large payload length, we should drop the connection
    right then rather than assuming the layer on top will be careful.
    This becomes more important when we permit 64-bit lengths which are
    even more likely to have the potential for attempted denial of service
    abuse.
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
    Message-ID: <20230608135653.2918540-8-eblake@redhat.com>
    70fa99f4
    nbd/client: Add safety check on chunk payload length
    Eric Blake authored
    
    
    Our existing use of structured replies either reads into a qiov capped
    at 32M (NBD_CMD_READ) or caps allocation to 1000 bytes (see
    NBD_MAX_MALLOC_PAYLOAD in block/nbd.c).  But the existing length
    checks are rather late; if we encounter a buggy (or malicious) server
    that sends a super-large payload length, we should drop the connection
    right then rather than assuming the layer on top will be careful.
    This becomes more important when we permit 64-bit lengths which are
    even more likely to have the potential for attempted denial of service
    abuse.
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
    Message-ID: <20230608135653.2918540-8-eblake@redhat.com>
Loading