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
F144456379: D37886.id114583.diff
Sun, Feb 8, 1:12 PM
Unknown Object (File)
Sat, Feb 7, 11:40 PM
Unknown Object (File)
Fri, Jan 30, 11:05 PM
Unknown Object (File)
Dec 15 2025, 11:46 AM
Unknown Object (File)
Dec 4 2025, 4:05 PM
Unknown Object (File)
Nov 25 2025, 2:42 PM
Unknown Object (File)
Nov 25 2025, 4:56 AM
Unknown Object (File)
Nov 16 2025, 12:45 AM
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