[CRIU] [PATCH 1/3] fsnotify: Add debug printing of the target link

Cyrill Gorcunov gorcunov at gmail.com
Sat Oct 12 10:06:17 PDT 2013


On Sat, Oct 12, 2013 at 08:45:11PM +0400, Andrew Vagin wrote:
> >  
> > -	pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s)\n",
> > -		 who, s_dev, i_ino, path);
> > +	if (log_get_loglevel() >= LOG_DEBUG) {
> > +		memzero(link, sizeof(link));
> > +		readlink(path, link, sizeof(link));
> > +		link[sizeof(link) - 1] = '\0';
> 
> This is wrong.
> 
> 		ret = readlink(path, link, sizeof(link) - 1);
> 		link[ret= = '\0';

Please, re-read the code, taking memzero into account. And don't
assume ret is positive here.


More information about the CRIU mailing list