New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix parse error when filename contains ']' #181
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR. |
A quick example, of which the non-patched version would complains echo -e '[[enc].rar]\npassword="test"' > conf
dd if=/dev/random of=rd.bin bs=4096 count=1
rar a -hptest '[enc].rar' rd.bin
mkdir -p mnt
rar2fs --config=$PWD/conf '[enc].rar' mnt As for |
Thanks for the short reproducer. I will try it and check your patch. The 'strstr' example you provided is an obvious substring/prefix match. The input file name is an absolute path while the config file works mount point relative. I will check your other 'strstr' replacements but I am pretty sure the purpose is (or used to be at least) to match on a possible sub-path and not for a guaranteed exact match. I hardly think you would see any real performance boost though by replacing 'strstr' with 'strlen' considering the simple use-case. Thus it would basically boil down to readability only and as such, highly subjective. |
Exactly, and simply adding a comment seems a better choice, considering the "It just works so don't touch anything not necessary" rule. Besides I also tried to compare the performance of these two methods and found almost no difference (https://gist.github.com/wesley800/a5473034f99ec1dc2bec41b6baa1f3cc). |
Can you please file an issue report since this is an obvious bug in the configuration file parser and link to the pull request. |
As title says.
BTW I also changed all
strstr
aiming for prefix matching tostrncmp
. I wonder if all these changed positions needs prefix matching, or precise matching? If the latter, could we just usestrcmp
instead?