Full_Name: Aron Ujvari
Submission from: (NULL) (126.96.36.199)
OpenLDAP 2.4.33 (and before) does not handle properly when in function
ldap_pvt_gethostbyname_a the 6-args version of gethostname_r returns ERANGE(34)
error code because of too small buffer size.
Although there is a loop in the function to increment the buffer size, but there
is no check for ERANGE(34) result in the "r" variable, so no use of the loop.
Relevant code is in libraries/libldap/util-int.c, lines 336-368.
The gethostbyname man page clearly states at GNU Extensions section that
gethostbyname_r can return non-zero value on failure, and return ERANGE if
is too small, and the call should be retried with a larger buffer in this case.