Skip to content

Commit

Permalink
Qt: Do not turn empty parameter values into spaces
Browse files Browse the repository at this point in the history
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>
(cherry picked from commit 727aaad)
Reviewed-on: https://code.wireshark.org/review/32891
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
  • Loading branch information
desowin authored and pquantin committed Apr 19, 2019
1 parent 3fbe882 commit 2a9e0e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ui/qt/extcap_options_dialog.cpp
Expand Up @@ -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);
}
Expand Down

0 comments on commit 2a9e0e2

Please sign in to comment.