shill: sanitize SSIDs for WiFiEndpoints.

In the same way that we sanitize SSIDs for WiFiServices,
sanitize SSIDs for WiFiEndpoints.

Previously, some log messages about Endpoints would be
truncated. This happened when the SSID included a NULL
byte.

BUG=None
TEST=new unit test

Change-Id: I4c361579255123091a0b4265837a16d4e930e60c
Reviewed-on: https://gerrit.chromium.org/gerrit/15698
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
diff --git a/wifi.h b/wifi.h
index 3793f91..aab6439 100644
--- a/wifi.h
+++ b/wifi.h
@@ -64,6 +64,11 @@
   // Called by Manager.
   virtual WiFiServiceRefPtr GetService(const KeyValueStore &args, Error *error);
 
+  // Utility, used by WiFiService and WiFiEndpoint.
+  // Replace non-ASCII characters with '?'. Return true if one or more
+  // characters were changed.
+  static bool SanitizeSSID(std::string *ssid);
+
  private:
   friend class WiFiMainTest;  // access to supplicant_*_proxy_, link_up_
   FRIEND_TEST(WiFiMainTest, InitialSupplicantState);  // kInterfaceStateUnknown