Page MenuHomeFreeBSD

h_resolv: Fix a buffer overflow in load().
ClosedPublic

Authored by jhb on Dec 27 2022, 10:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 28, 12:52 AM
Unknown Object (File)
Tue, Apr 21, 11:55 AM
Unknown Object (File)
Apr 8 2026, 9:59 AM
Unknown Object (File)
Apr 2 2026, 2:35 AM
Unknown Object (File)
Apr 1 2026, 7:29 PM
Unknown Object (File)
Mar 17 2026, 7:47 AM
Unknown Object (File)
Mar 12 2026, 8:28 PM
Unknown Object (File)
Mar 8 2026, 6:17 PM
Subscribers

Details

Summary

fgetln() returns a pointer to an array of characters that is 'len'
characters long, not 'len + 1'. While here, overwriting the contents
of the buffer returned by fgetln isn't really safe, so switch to using
getline() instead.

Note that these fixes are a subset of those applied to a
near-identical copy of this function in libc's resolv_test.c in commit
2afeaad315ac19450389b8f2befdbe7c91c37818.

Reported by: CHERI (buffer overflow)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable