packfile: correct zlib buffer handling