Hi Sergey, You are right, a conforming producer NUL-terminates them, and I should have argued from malformed input rather than from the format.
The read side is where it bites. Take an archive that does not conform, with uname, gname and the rest of the record set to non-NUL bytes. getuidbyname passes uname to getpwnam as a C string and reads past the end of the 512-byte record. A plain "cpio -itv < archive" reaches it, since ustar is auto-detected and numeric_uid is off by default. That is the ASan overread in the patch. It mirrors the write side you bounded in e8931bebb9e1: the field is fixed width, so the reader should not assume the bytes are terminated either. If you would rather not harden against non-conforming archives here, I understand. Happy to resend with the rationale reframed if it is worth taking. Regards, Cole
