memcached_connection type)
{
memset(host, 0, sizeof(memcached_server_st));
- memcpy(host->hostname, hostname, strlen(hostname));
+ strncpy(host->hostname, hostname, MEMCACHED_MAX_HOST_LENGTH - 1);
host->port= port;
host->fd= -1;
host->type= type;
unsigned int count;
memcached_server_st *new_host_list;
- if (!hostname)
- return ptr;
+ if (hostname == NULL || error == NULL)
+ return NULL;
if (!port)
port= MEMCACHED_DEFAULT_PORT;