Page MenuHomeFreeBSD

cap_dns, cap_net: fix host and service buffer handling
ClosedPublic

Authored by vangyzen on Mar 30 2023, 10:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 7, 10:27 AM
Unknown Object (File)
Tue, Sep 30, 5:05 AM
Unknown Object (File)
Sep 12 2025, 11:19 AM
Unknown Object (File)
Sep 10 2025, 5:20 AM
Unknown Object (File)
Aug 26 2025, 7:46 AM
Unknown Object (File)
Aug 26 2025, 6:46 AM
Unknown Object (File)
Aug 26 2025, 2:03 AM
Unknown Object (File)
Aug 26 2025, 12:57 AM

Details

Summary

If a malicious casper process sent a host or service string that was
too long, cap_getnameinfo would overrun the caller's buffer by one byte.

The backends for this function needlessly allocated one extra byte
for these buffers. This was harmless, but could be confusing to readers.

Reported by: Coverity
MFC after: 1 week
Sponsored by: Dell EMC Isilon

Test Plan
$ kyua debug net_test:capnet__getnameinfo_overflow
net_test:capnet__getnameinfo_overflow  ->  passed

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 50684
Build 47575: arc lint + arc unit

Event Timeline

please add the CID to the commit message

(unless this is not from Coverity Scan's FreeBSD report)

This revision is now accepted and ready to land.Apr 4 2023, 6:18 PM

please add the CID to the commit message
(unless this is not from Coverity Scan's FreeBSD report)

It's from an internal run at Dell (Isilon). Oddly enough, I can't find this issue in the public FreeBSD report.

Thanks for the reviews, folks.