Bug 1031647 - Change string API usage. r=ehsan
☠☠ backed out by 9d7c9f78230b ☠ ☠
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 15 Oct 2014 10:15:39 +0900
changeset 210485 118d4c56c3c4deedb28a2497af27bbdfbe094902
parent 210484 4f520729fb387922f460d790e2ad8bd49ba0275b
child 210486 9d7c9f78230b21a33bc40a03bdcaf05f5d9c6824
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersehsan
bugs1031647
milestone36.0a1
Bug 1031647 - Change string API usage. r=ehsan
dom/system/gonk/NetworkUtils.cpp
--- a/dom/system/gonk/NetworkUtils.cpp
+++ b/dom/system/gonk/NetworkUtils.cpp
@@ -735,18 +735,18 @@ void NetworkUtils::postTetherInterfaceLi
                                            CommandCallback aCallback,
                                            NetworkResultOptions& aResult)
 {
   // Send the dummy command to continue the function chain.
   char command[MAX_COMMAND_SIZE];
   snprintf(command, MAX_COMMAND_SIZE - 1, "%s", DUMMY_COMMAND);
 
   char buf[BUF_SIZE];
-  const char* reason = NS_ConvertUTF16toUTF8(aResult.mResultReason).get();
-  memcpy(buf, reason, strlen(reason));
+  NS_ConvertUTF16toUTF8 reason(aResult.mResultReason);
+  memcpy(buf, reason.get(), reason.Lenth() + 1);
   split(buf, INTERFACE_DELIMIT, GET_FIELD(mInterfaceList));
 
   doCommand(command, aChain, aCallback);
 }
 
 void NetworkUtils::setIpForwardingEnabled(CommandChain* aChain,
                                           CommandCallback aCallback,
                                           NetworkResultOptions& aResult)