Menu

#69 owfs --fuse-open-opt broken (segfault)

up_to_v0.8
open
nobody
None
1
2016-02-18
2016-02-18
Cheetah
No

Trying to pass --fuse-open-opt to owfs doesn't work, segfaults every time.

The Fuse_arg function seems inherently broken:

Only asks for one match:
orm.number = 1 ;
But if it gets it, tries to dereference the second match?
ret = owstrdup(orm.match[1]); // start after first quote
And strdup(NULL) = segfault.

It looks like it's trying to extract the bit between quotes? For which the code seems quite wrong.

Looks like this was broken by [29ddff] (regex)

I think the fix is to add a capture group to the regex, e.g.:
ow_regcomp( &rx_farg, "^\"\(.+\)\"$", 0 ) ;

Related

Commit: [29ddff]

Discussion

  • Cheetah

    Cheetah - 2016-02-18

    Tested the above regex change and it works for me, except no backslashes on the parens.

    This begs the question, why use a regex for this? It seems excessive as a means to validate that the string starts and ends with a quote and then strip off those quotes.

    This further begs the question why it even wants that option "\"double quoted\"" if all it's going to do is strip the quotes off?

     

    Last edit: Cheetah 2016-02-18
  • Cheetah

    Cheetah - 2016-02-18

    fuse-opt-fix: patch fixing the above

     
  • Jan Kandziora

    Jan Kandziora - 2016-02-18

    Yes, as it accesses orm.match[1] a few lines later there has to be a paranthesed subexpression. Have added your patch. Thanks.