Skip to content
  • Jeremy Linton's avatar
    packfile: correct zlib buffer handling · b611396e
    Jeremy Linton authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The buffer being passed to zlib includes a NUL terminator that git
    needs to keep in place. unpack_compressed_entry() attempts to detect
    the case that the source buffer hasn't been fully consumed by
    checking to see if the destination buffer has been over consumed.
    
    This causes a problem, that more recent zlib patches have been
    poisoning the unconsumed portions of the buffer which overwrites
    the NUL byte, while correctly returning length and status.
    
    Let's place the NUL at the end of the buffer after inflate returns
    to assure that it doesn't result in problems for git even if its
    been overwritten by zlib.
    
    Signed-off-by: default avatarJeremy Linton <lintonrjeremy@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    b611396e