]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/os-ip.c
ITS#8262 add ldap_build_*_req functions
[openldap] / libraries / libldap / os-ip.c
index b31e05dc9be58227710e18ed694af6b6c2e14427..c0b83f30bdd7ce27fc0579a9c4825c9e608f7901 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2013 The OpenLDAP Foundation.
+ * Copyright 1998-2015 The OpenLDAP Foundation.
  * Portions Copyright 1999 Lars Uffmann.
  * All rights reserved.
  *
@@ -422,8 +422,8 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
        if (LDAP_IS_UDP(ld)) {
                if (ld->ld_options.ldo_peer)
                        ldap_memfree(ld->ld_options.ldo_peer);
-               ld->ld_options.ldo_peer=ldap_memalloc(sizeof(struct sockaddr));
-               AC_MEMCPY(ld->ld_options.ldo_peer,sin,sizeof(struct sockaddr));
+               ld->ld_options.ldo_peer=ldap_memcalloc(1, sizeof(struct sockaddr_storage));
+               AC_MEMCPY(ld->ld_options.ldo_peer,sin,addrlen);
                return ( 0 );
        }
 #endif