8000 strutils.c: ignore escape characters while parsing options. by echoechoin · Pull Request #3541 · util-linux/util-linux · GitHub
[go: up one dir, main page]

Skip to content

strutils.c: ignore escape characters while parsing options. #3541

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

Merged
merged 1 commit into from
May 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/strutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}
Expand Down
0