HomeFreeBSD

tarfs: Fix issues revealed by static analysis and testing.

Description

tarfs: Fix issues revealed by static analysis and testing.

  • tarfs_alloc_mount(): Remove an unnecessary null check (CID 1504505) and an unused variable.
  • tarfs_alloc_one(): Verify that the file size is not negative (CID 1504506). While there, also validate the mode, owner and group.
  • tarfs_vget(), tarfs_zio_init(): Explicitly ignore return value from getnewvnode(), which cannot fail (CID 1504508)
  • tarfs_lookup_path(): Fix a case where a specially-crafted tarball could trigger a null pointer dereference by first descending into, and then backing out of, a previously unknown directory. (CID 1504515)
  • mktar: Construct a tarball that triggers the aforementioned null pointer dereference.

Reported by: Coverity
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D38463

Details

Provenance
desAuthored on Feb 9 2023, 5:35 PM
Reviewer
imp
Differential Revision
D38463: tarfs: Fix issues revealed by static analysis and testing.
Parents
rG43d4680b399b: MINIMAL: Update and clean up.
Branches
Unknown
Tags
Unknown