|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 15/18] xenstore: New function xs_path_is_subpath
Ian Campbell writes ("Re: [Xen-devel] [PATCH 15/18] xenstore: New function
xs_path_is_subpath"):
> On Fri, 2011-12-09 at 18:54 +0000, Ian Jackson wrote:
> > + if (childlen > parentlen && child[parentlen] != '/')
> > + return false;
>
> It took me a second to figure that this last statement was preventing
> false positives from sibling directories where one is a substring of the
> other. Worth a comment?
Probably, yes.
> Doesn't the correctness of this depend on whether parent has a trailing
> slash or not though?
We don't allow trailing slashes. They don't work in xenstore
operations. However, there is one exception: "/". If parent is "/"
the algorithm is wrong.
So docs/misc/xenstore.txt needs updating to clarify the former and my
new function needs the latter fixing.
These are the perils of taking code that was correct in situ and
making a general function out of it, I guess ...
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |