From: Herman Semenov GermanAizek@yandex.ru
--- dlls/wldap32/init.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/wldap32/init.c b/dlls/wldap32/init.c index 44fc44ee485..be1b9acd4d1 100644 --- a/dlls/wldap32/init.c +++ b/dlls/wldap32/init.c @@ -124,11 +124,14 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum
sprintf( port, ":%lu", portnumber );
+ size_t scheme_len = strlen( scheme ); + size_t port_len = strlen( port ); + for (v = hostnames; *v; v++) { if (!has_ldap_scheme( *v )) { - size += strlen( scheme ); + size += scheme_len; q = *v; } else @@ -138,12 +141,13 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum size += strlen( *v );
if (!strchr( q, ':' )) - size += strlen( port ); + size += port_len;
i++; }
- size += (i - 1) * strlen( sep ); + size_t sep_len = strlen( sep ); + size += (i - 1) * sep_len; if (!(res = malloc( size + 1 ))) return NULL;
p = res; @@ -152,13 +156,13 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum if (v != hostnames) { strcpy( p, sep ); - p += strlen( sep ); + p += sep_len; }
if (!has_ldap_scheme( *v )) { strcpy( p, scheme ); - p += strlen( scheme ); + p += scheme_len; q = *v; } else @@ -171,7 +175,7 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum if (!strchr( q, ':' )) { strcpy( p, port ); - p += strlen( port ); + p += port_len; } } return res;