[PATCH 6/8]: wpa_gui-qt4: check id_str is a single string of word characters

Kel Modderman kel at otaku42.de
Wed Jan 23 07:19:57 EST 2008


The network Identification string should be a simple string of characters
that match the \w abbreviation for word only characters (with -) to prevent
potential errors from external networking tools that may use it.

Present a warning if the word contains characters not in the set:
[A-Za-z0-9_-]

Signed-off-by: Kel Modderman <kel at otaku42.de>
---
--- a/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
@@ -142,6 +142,20 @@
 		}
 	}
 
+	if (idstrEdit->isEnabled() && !idstrEdit->text().isEmpty()) {
+		QRegExp rx("^(\\w|-)+$");
+		if (rx.indexIn(idstrEdit->text()) < 0) {
+			QMessageBox::warning(this, "Network ID Error",
+					     "Network ID String contains "
+					     "non-word characters.\n"
+					     "It must be a simple string, "
+					     "without spaces, containing\n"
+					     "only characters in this range: "
+					     "[A-Za-z0-9_-]\n");
+			return;
+		}
+	}
+
 	if (wpagui == NULL)
 		return;
 
---


More information about the HostAP mailing list