[LTP] [PATCH v7 1/3] lib: alter find_free_loopdev()

Petr Vorel pvorel@suse.cz
Wed Jul 31 23:06:04 CEST 2019


Hi,

> Hi!
> > > > > -			return 0;
> > > > > +			if (path != NULL)
> > > > > +				strncpy(path, buf, path_len);
> > > > Is it safe to assume that path_len is *always* < 1024 (size of buf)?

> > > strncpy() is tricky that it may not null-terminate the string if the
> > > source is too long, I would have just added path[path_len-1] = 0 after
> > > the strncpy() here.
> > I was thinking about it as well.
> > I suggest to merge it with this change (+ tiny change I proposed in docs).

> I'm okay with that.
Merged into master with these changes and slightly changed commit messages.

Kind regards,
Petr


More information about the ltp mailing list