diff options
author | Alexey Izbyshev <izbyshev@ispras.ru> | 2023-02-27 23:18:02 +0300 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2023-02-28 12:00:55 -0500 |
commit | 595416b11dfbc82d40a59d0edd7e3b04ba7a2d6d (patch) | |
tree | c0c7ecedfe3f6413f851fff003b7282146ae73ae /include/link.h | |
parent | 1a708ece1ad8b924466e81c5fcdf4e22311fd770 (diff) | |
download | musl-595416b11dfbc82d40a59d0edd7e3b04ba7a2d6d.tar.gz musl-595416b11dfbc82d40a59d0edd7e3b04ba7a2d6d.tar.bz2 musl-595416b11dfbc82d40a59d0edd7e3b04ba7a2d6d.tar.xz musl-595416b11dfbc82d40a59d0edd7e3b04ba7a2d6d.zip |
getservbyport_r: fix out-of-bounds buffer read
If the buffer passed to getservbyport_r is just enough to store two
pointers after aligning it, getnameinfo is called with buflen == 0
(which means that service name is not needed) and trivially succeeds.
Then, strtol is called on the address just past the buffer end, and
if it doesn't happen to find the port number there, getservbyport_r
spuriously succeeds and returns the same bad address to the caller.
Fix this by ensuring that buflen is at least 1 when passed to
getnameinfo.
Diffstat (limited to 'include/link.h')
0 files changed, 0 insertions, 0 deletions