[CRIU] Re: [PATCH] proc: Make sure eol remains on task name

Cyrill Gorcunov gorcunov at openvz.org
Thu May 3 08:43:27 EDT 2012


On Thu, May 03, 2012 at 04:26:55PM +0400, Andrew Vagin wrote:
> 
> > +
> > +size_t strlcpy(char *dest, const char *src, size_t size)
> > +{
> > +	size_t ret = strlen(src);
> > +
> > +	if (size) {
> > +		size_t len = (ret >= size) ? size - 1 : ret;
> > +		memcpy(dest, src, len);
> > +		dest[len] = '\0';
> > +	}
> 	} else
> 		dest[0] = '\0';
> Otherwise it's dangerous.

Agreed, I can update (actually I picked it up from linux kernel ;)

	Cyrill


More information about the CRIU mailing list