From: WanBingjiang Date: Tue, 22 Apr 2025 10:16:41 +0000 (+0800) Subject: strutils.c: ignore escape characters while parsing options. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a69fa852dd5f41f8456756d18bfac6d8208219f;p=thirdparty%2Futil-linux.git strutils.c: ignore escape characters while parsing options. --- 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 \n" " %1$s --cstrcasecmp \n" " %1$s --normalize \n" - " %1$s --strto{s,u}{16,32,64} \n", + " %1$s --strto{s,u}{16,32,64} \n" + " %1$s --optstr \n", argv[0]); exit(EXIT_FAILURE); }