[Bug 505278] - nsWifiAccessPoint::GetSsid doesn't do what it thinks it does with embedded nulls. r=dbaron
authorDoug Turner <dougt@meer.net>
Wed, 22 Jul 2009 13:32:40 -0700
changeset 30561 6a26645dc206f1e9b192c4b0c6b3cbef2f107c56
parent 30560 62d18b867afbe00b995150472f3137d5316c453d
child 30562 02913e3a7eafedd3100380ea9e63846343cfb32e
push id8138
push userdougt@mozilla.com
push dateWed, 22 Jul 2009 20:33:55 +0000
treeherdermozilla-central@02913e3a7eaf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs505278
milestone1.9.2a1pre
[Bug 505278] - nsWifiAccessPoint::GetSsid doesn't do what it thinks it does with embedded nulls. r=dbaron
netwerk/wifi/src/nsWifiAccessPoint.cpp
--- a/netwerk/wifi/src/nsWifiAccessPoint.cpp
+++ b/netwerk/wifi/src/nsWifiAccessPoint.cpp
@@ -33,16 +33,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsWifiAccessPoint.h"
+#include "nsString.h"
 #include "nsMemory.h"
 #include "prlog.h"
 
 #if defined(PR_LOGGING)
 extern PRLogModuleInfo *gWifiMonitorLog;
 #endif
 #define LOG(args)     PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args)
 
@@ -66,21 +67,17 @@ NS_IMETHODIMP nsWifiAccessPoint::GetMac(
   aMac.Assign(mMac);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsWifiAccessPoint::GetSsid(nsAString& aSsid)
 {
   // just assign and embedded nulls will truncate resulting
   // in a displayable string.
-
-  nsString tempStr;
-  tempStr.AssignWithConversion(mSsid, mSsidLen);
-  aSsid = tempStr;
-
+  CopyASCIItoUTF16(mSsid, aSsid);
   return NS_OK;
 }
 
 
 NS_IMETHODIMP nsWifiAccessPoint::GetRawSSID(nsACString& aRawSsid)
 {
   aRawSsid.Assign(mSsid, mSsidLen); // SSIDs are 32 chars long
   return NS_OK;