[sheepdog] [PATCH v2] zookeeper: multi-sheep cluster in one zookeeper support

Xu Yifeng skypexu at gmail.com
Sat Feb 28 10:04:48 CET 2015


On 2015年02月28日 16:44, Yu Yang wrote:
> char root[MAX_NODE_STR_LEN];
> +	char conn[MAX_NODE_STR_LEN];
> +	const char *p = strchr(hosts, '/');
> +	int interval, max_retry, retry;
> +	int i = 0;
> +	strcpy(root, p);
> +	while (hosts != p)
> +		conn[i++] = *hosts++;
> +	conn[i] = '\0';

Can we add bounds check here ? I hate to see silently buffer overflow,  even
in real world, it might not be a problem. If user can input more than 
256 characters,
strdup and strndup will work, returning NULL and crashing when accessing 
the first page
is still better than silently buffer overflow .

Regards,



More information about the sheepdog mailing list