• Ryan Sleevi's avatar
    Explicitly handle zero-byte NTLM buffer writes · 4d94d132
    Ryan Sleevi authored
    r558579 changed the backing store of NTLM writes from being a
    std::basic_string<uint8_t> to a std::vector<uint8_t>, to better align
    with its purpose. This change had the effect of causing .data() to now
    return nullptr when .size() == 0, rather than the previous behaviour,
    in which .data() would return a 1-byte buffer that was a NUL ('\0')
    terminator - the consequence of using std::basic_string<>.
    
    This had the effect on writes which expected zero-byte writes (aka
    no-ops) to succeed, in that GetBufferPtr() now returned nullptr, rather
    than a valid pointer. Since zero-byte memcpys immediately follow, this
    needs to be explicitly handled, as memcpy() requires both pointers be
    valid, even for zero-byte writes.
    
    BUG=843066
    
    Change-Id: I9ff8f825469142da31abc866c81f0418ae25f93f
    Reviewed-on: https://chromium-review.googlesource.com/1059449
    Commit-Queue: Ryan Sleevi <rsleevi@chromium.org>
    Reviewed-by: default avatarAsanka Herath <asanka@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#558812}
    4d94d132
ntlm_buffer_reader.cc 8.05 KB