From 2a9e0e28624514abd9f841d6c3c0e1249ab3139d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Thu, 18 Apr 2019 16:41:59 +0200 Subject: [PATCH] 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 Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman (cherry picked from commit 727aaad3ae99132470ea0a9eba912aea8ef83ef3) Reviewed-on: https://code.wireshark.org/review/32891 Petri-Dish: Pascal Quantin Reviewed-by: Pascal Quantin --- ui/qt/extcap_options_dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/qt/extcap_options_dialog.cpp b/ui/qt/extcap_options_dialog.cpp index 53d2ffa1d4a..3861f446bd4 100644 --- a/ui/qt/extcap_options_dialog.cpp +++ b/ui/qt/extcap_options_dialog.cpp @@ -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); }