Gentoo Archives: gentoo-alt

From: Markus Duft <mduft@g.o>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] chpathtool
Date: Fri, 25 Sep 2009 06:51:55
Message-Id: 4ABC67D3.2030106@gentoo.org
In Reply to: Re: [gentoo-alt] chpathtool by Fabian Groffen
1 Fabian Groffen wrote:
2 > On 22-09-2009 16:11:19 +0200, Markus Duft wrote:
3 >> Markus Duft wrote:
4 >>> Hey!
5 >>>
6 >>> seems i found a problem with chpathtool. i tried to chpath a whole
7 >>> prefix at once recursively, but some files make chpathtool crash. i
8 >>> attached one of them, could you have a look at it? i debugged the
9 >>> problem on my gentoo linux box, but no luck.
10 >>>
11 >> trying again, i found something: it's a off-by-on if the file ends with
12 >> for example '/', which makes memstr yield a partial match to magic...
13 >
14 > it's not an off-by-one, what goes wrong here is the case where you match
15 > the start of magic at the end of the buffer, and then try to move the
16 > entire length of magic, which of course is not there.
17 >
18 >> i have a patch for this (attached), that seems to fix it (not sure
19 >> wether it destroys something else ;)). could you double check, and
20 >> apply? Thanks!
21 >
22 > I solved it a little bit different, but I think the logic eventually is
23 > the same.
24 >
25 >> owh... and: chpathtool only works as long as magic and value are the
26 >> same length. it immediatly (after 10 files or so) crashes if value is
27 >> less than magic ...
28 >
29 > Hmmm, it runs happily on a directory here without problems, do you have
30 > another testcase perhaps?
31
32 hmm... with different magic and value string lengths? i know value >
33 magic is not possible, but the other way round crashed here on interix.
34 i'll try to repro on a linux box, which may be a little bit more common
35 than interix (and a lot faster of course ;)).
36
37 Cheers, Markus
38
39 >
40 >