• Jeff Layton's avatar
    cifs: sanitize length checking in coalesce_t2 (try #3) · 2a2047bc
    Jeff Layton authored
    There are a couple of places in this code where these values can wrap or
    go negative, and that could potentially end up overflowing the buffer.
    Ensure that that doesn't happen. Do all of the length calculation and
    checks first, and only perform the memcpy after they pass.
    
    Also, increase some stack variables to 32 bits to ensure that they don't
    wrap without being detected.
    
    Finally, change the error codes to be a bit more descriptive of any
    problems detected. -EINVAL isn't very accurate.
    
    Cc: stable@kernel.org
    Reported-and-Acked-by: default avatarDavid Howells <dhowells@redhat.com>
    Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
    Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
    2a2047bc
connect.c 98 KB