Page MenuHomeFreeBSD

tar: fix off-bounds read resulting from #2787 (3150539ed)
AbandonedPublic

Authored by ngie on Jan 5 2026, 1:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jan 20, 4:59 AM
Unknown Object (File)
Sun, Jan 18, 2:59 AM
Unknown Object (File)
Thu, Jan 15, 2:22 AM
Unknown Object (File)
Sat, Jan 10, 3:41 PM
Unknown Object (File)
Sat, Jan 10, 12:39 PM
Unknown Object (File)
Sat, Jan 10, 4:59 AM
Unknown Object (File)
Fri, Jan 9, 11:33 PM
Unknown Object (File)
Fri, Jan 9, 5:29 PM
Subscribers

Details

Reviewers
mm
delphij
Summary

(additional summary proposed by me)

3.8.4 introduced a regression that allowed users of tar could provide -s with specially crafted input could crash tar(1) due to incorrect buffer accesses.

Whether or not this is a CVE-worthy issue is still TBD. I would need to take a look at the NIST CVE rubric to see what the criteria is for rating the issue.

Test Plan

This change unbreaks kyua test -k /usr/tests/usr.bin/tar/Kyuafile on :main and fixes tar -s with specially crafted input.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69608
Build 66491: arc lint + arc unit

Event Timeline

ngie requested review of this revision.Jan 5 2026, 1:30 AM
ngie added reviewers: mm, delphij.
ngie added a subscriber: secteam.
ngie edited the test plan for this revision. (Show Details)
ngie added a subscriber: lwhsu.
contrib/libarchive/tar/subst.c
297

This is the only net change in the patch: instead of the enclosed blocks being executed in all cases, it's now only executed when isEnd is false, i.e., the current deref'ed pointer is \0.

contrib/libarchive/tar/subst.c
297

... the current deref'ed pointer is \0.

I meant to say:

the current deref'ed pointer is not \0.

Abandoning as @mm is planning on cutting a new libarchive release soon which will include this fix (and others).