mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-02-23 14:09:39 +08:00
Import fixes from HEAD - ITS#1936 and res_query reply buffer sizes
This commit is contained in:
parent
114d16494c
commit
fe336b15c5
@ -195,10 +195,11 @@ int ldap_domain2hostlist(
|
||||
char **list )
|
||||
{
|
||||
#ifdef HAVE_RES_QUERY
|
||||
#define DNSBUFSIZ (64*1024)
|
||||
char *request;
|
||||
char *hostlist = NULL;
|
||||
int rc, len, cur = 0;
|
||||
unsigned char reply[1024];
|
||||
unsigned char reply[DNSBUFSIZ];
|
||||
|
||||
if( domain == NULL || *domain == '\0' ) {
|
||||
return LDAP_PARAM_ERROR;
|
||||
@ -222,7 +223,7 @@ int ldap_domain2hostlist(
|
||||
len = res_query(request, C_IN, T_SRV, reply, sizeof(reply));
|
||||
if (len >= 0) {
|
||||
unsigned char *p;
|
||||
char host[1024];
|
||||
char host[DNSBUFSIZ];
|
||||
int status;
|
||||
u_short port;
|
||||
/* int priority, weight; */
|
||||
@ -263,7 +264,7 @@ int ldap_domain2hostlist(
|
||||
/* weight = (p[2] << 8) | p[3]; */
|
||||
port = (p[4] << 8) | p[5];
|
||||
|
||||
buflen = strlen(host) + sizeof(":65355");
|
||||
buflen = strlen(host) + sizeof(":65355 ");
|
||||
hostlist = (char *) LDAP_REALLOC(hostlist, cur + buflen);
|
||||
if (hostlist == NULL) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
|
Loading…
Reference in New Issue
Block a user