]> git.ipfire.org Git - thirdparty/libarchive.git/commit
cpio: fix read-ahead pointer lifetime issue 3277/head
authordatauwu <datauwu@users.noreply.github.com>
Sat, 11 Jul 2026 04:06:46 +0000 (12:06 +0800)
committerdatauwu <datauwu@users.noreply.github.com>
Sat, 11 Jul 2026 04:11:53 +0000 (12:11 +0800)
commit23b54da0baae02be3beb41ade8e674bcad535310
treea615935cadd3863d44ae82b5f25a5154c04e8ad3
parent98d1ceeca660e96943a6e7021b116bdab3c9d13d
cpio: fix read-ahead pointer lifetime issue

Cache the CPIO trailer-name check before consuming the pathname
buffer.

The reader kept a pointer returned by __archive_read_ahead() and used
it after __archive_read_consume(), and after possible symlink body
processing. Read-ahead pointers are views into libarchive input buffers
and should not be relied on after the associated bytes are consumed.

Store the TRAILER!!! decision while the pathname buffer is still valid,
then use the saved boolean after the remaining header handling.
libarchive/archive_read_support_format_cpio.c