Issue#7530 - Test for ERANGE when using 6 form gethostbyname_r

This commit is contained in:
Quanah Gibson-Mount 2020-05-22 23:45:40 +00:00
parent c70e2e0869
commit fb1933f567

View file

@ -445,8 +445,12 @@ int ldap_pvt_gethostbyname_a(
*result=gethostbyname_r( name, resbuf, *buf, buflen, herrno_ptr ); *result=gethostbyname_r( name, resbuf, *buf, buflen, herrno_ptr );
r = (*result == NULL) ? -1 : 0; r = (*result == NULL) ? -1 : 0;
#else #else
r = gethostbyname_r( name, resbuf, *buf, while((r = gethostbyname_r( name, resbuf, *buf, buflen, result, herrno_ptr )) == ERANGE) {
buflen, result, herrno_ptr ); /* Increase the buffer */
buflen*=2;
if (safe_realloc(buf, buflen) == NULL)
return -1;
}
#endif #endif
Debug2( LDAP_DEBUG_TRACE, "ldap_pvt_gethostbyname_a: host=%s, r=%d\n", Debug2( LDAP_DEBUG_TRACE, "ldap_pvt_gethostbyname_a: host=%s, r=%d\n",