-
Notifications
You must be signed in to change notification settings - Fork 1.3k
mount: overlayfs options cannot have odd number of double quotes (") #3537
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
Comments
int ul_optstr_next(char **optstr, char **name, size_t *namesz,
char **value, size_t *valsz)
{
...
if (!start)
start = p; /* beginning of the option item */
if (*p == '"')
open_quote ^= 1; /* reverse the status */
...
|
The code supports a quotation mark to suppress the interpretation of other characters in the string. For example, you can use it for option names as well. I believe the correct solution is to support escaping the quotation mark. It's already supported for a comma. Something like: diff --git a/lib/strutils.c b/lib/strutils.c
index 0cf0da96b..8dc7f2513 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -1235,7 +1235,7 @@ int ul_optstr_next(char **optstr, char **name, size_t *namesz,
return -EINVAL;
if (!start)
start = p; /* beginning of the option item */
- if (*p == '"')
+ if (*p == '"' && (p == optstr0 || *(p - 1) != '\\'))
open_quote ^= 1; /* reverse the status */
if (open_quote)
continue; /* still in quoted block */
@@ -1480,7 +1480,8 @@ int main(int argc, char *argv[])
" %1$s --stralnumcmp <str> <str>\n"
" %1$s --cstrcasecmp <str> <str>\n"
" %1$s --normalize <str>\n"
- " %1$s --strto{s,u}{16,32,64} <str>\n",
+ " %1$s --strto{s,u}{16,32,64} <str>\n"
+ " %1$s --optstr <str>\n",
argv[0]);
exit(EXIT_FAILURE);
} The patch also adds --optstr to make test_strutils
./test_strutils --optstr 'foo="bar"' The problem is that the caller needs to care about the escape, as ul_optstr_next() is just a parser. See f6c29ef for more details. |
Do you want to prepare a patch? |
To reproduce:
Dmesg (and strace) show that the lowerdir option was not provided. If upperdir uses the path with a quote, then that option is shown not to be provided.
Trying to escape the quotes with sequences like
lowerdir='low\"er'
andlowerdir='"low\"er"'
does not work.With an even number of quotes, it works:
Using the mount() syscall however works fine.
The text was updated successfully, but these errors were encountered: