Qt: Do not turn empty parameter values into spaces

Before this change extcap parameters without value would be silently
changed into a single space on parameters load.
This could lead to not only passing unexpected values to extcap call
arguments but also "auto-fill" text values without user consent.

Example scenario to observe this problem using extcap_example.py was:
  1. Open "Example interface 1 for extcap" configuration
  2. Click Restore Defaults
  3. Enter message, so the capture can be started
  4. Make sure "Save parameter on capture start" is enabled
  5. Start capture
  6. Notice that capture starts normally and extcap arguments are ok
  7. Stop capture
  8. Start capture again
  9. Notice that parameters were reloaded and the extcap was called with
     following unwanted arguments:
       --logfile " " --radio " " --multi " "

Bug: 15065
Change-Id: I9cd87d9cc8c7e4f8893a066e9f10aa760b52bb97
Reviewed-on: https://code.wireshark.org/review/32887
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Tomasz Moń 2019-04-18 16:41:59 +02:00 committed by Anders Broman
parent 66b3a33bcb
commit 727aaad3ae
1 changed files with 1 additions and 1 deletions

View File

@ -598,7 +598,7 @@ GHashTable *ExtcapOptionsDialog::getArgumentSettings(bool useCallsAsKey)
if (key.length() > 0)
{
gchar * val = g_strdup(value.length() == 0 ? " " : value.toStdString().c_str());
gchar * val = g_strdup(value.toStdString().c_str());
g_hash_table_insert(entries, g_strdup(key.toStdString().c_str()), val);
}