]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Fix NULL pointer dereference in archive_acl_from_text_nl 2905/head
authorGeorgios Patsakas <126084481+Patsakas@users.noreply.github.com>
Thu, 12 Mar 2026 20:24:13 +0000 (22:24 +0200)
committerGitHub <noreply@github.com>
Thu, 12 Mar 2026 20:24:13 +0000 (22:24 +0200)
commit4b3ba035ed01f26a6befa35be8399ae6e67ad449
treeb0aa10696ee6a514d13a5e276648325c2ede75ca
parent78b632c3363751ca5d4a790c78a6fbd49cfaac59
Fix NULL pointer dereference in archive_acl_from_text_nl

### Summary
This PR fixes a NULL pointer dereference in `archive_acl_from_text_nl()` (located in `archive_acl.c`) that occurs when parsing malformed PAX tar archives containing a short "default" ACL prefix.

### Technical Details
This is a variant of the bug previously fixed in the wide-character version `archive_acl_from_text_w()` via commit 7a6549a6 (Issue #2744).

The vulnerability exists because `st = field[n].start + 1` is calculated before verifying if the field length is zero. In cases of malformed entries, `field[n].start` can be NULL, leading to Undefined Behavior/SIGILL. This patch applies the same logic from the wide-char fix: moving the pointer increment after the length guard.

### Validation
- **Environment:** Ubuntu 24.04, compiled with AddressSanitizer (ASan) and UndefinedBehaviorSanitizer (UBSan).
- **Reproduction:** Verified that the minimized PAX tar archive provided in issue #2904 no longer triggers the crash.
- **Regression:** All existing library tests pass.

Closes #2904
libarchive/archive_acl.c