diff options
author | Katarina Behrens <katarina.behrens@qt.io> | 2023-05-16 15:45:08 +0200 |
---|---|---|
committer | Katarina Behrens <kati@froglogic.com> | 2023-05-24 10:07:13 +0200 |
commit | 5e40bbb186866b143fadabbafd2eed02c723a87f (patch) | |
tree | 01f63f35d331b744e93e334e5fcfeaab300d6098 /src | |
parent | 8d72fb0c76db430488066b579fe787caf3889895 (diff) |
Consider full length of 'key=value' string in user arguments
In 'key=value' pairs passed to IFW on command line, 'value' can be
any string, including base64-encoded string which may contain 1 or 2
trailing '=' chars
The current algorithm of splitting 'key=value' string into sections
using '=' as separator and assigning field[1,1] to 'value' works in
most common case (no further '=' chars in 'value'). It fails sometimes
if 'value' is base64-encoded string as it cuts off the portion of
the string at 2nd '=' char and beyond, thereby discards trailing '='s,
which are significant. This invalidates the string.
To avoid this, we use QString.section to return fields[1,-1]
(i.e. everything starting from field1 to the end of the string)
and assign the result to 'value'
Change-Id: Ide4f1510170ad4685b5bb40a96d88898476553ea
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/sdk/sdkapp.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sdk/sdkapp.h b/src/sdk/sdkapp.h index 42b2bee02..e2b7b5e3d 100644 --- a/src/sdk/sdkapp.h +++ b/src/sdk/sdkapp.h @@ -556,7 +556,7 @@ public: foreach (const QString &argument, positionalArguments) { if (argument.contains(QLatin1Char('='))) { const QString name = argument.section(QLatin1Char('='), 0, 0); - const QString value = argument.section(QLatin1Char('='), 1, 1); + const QString value = argument.section(QLatin1Char('='), 1); params.insert(name, value); } } |