diff --git a/xpcom/string/nsCharTraits.h b/xpcom/string/nsCharTraits.h
--- a/xpcom/string/nsCharTraits.h
+++ b/xpcom/string/nsCharTraits.h
@@ -139,16 +139,20 @@ struct nsCharTraits<char16_t>
   {
     return static_cast<char_type*>(memmove(aStr1, aStr2,
                                            aN * sizeof(char_type)));
   }
 
   static char_type*
   copy(char_type* aStr1, const char_type* aStr2, size_t aN)
   {
+    if (1 == aN) {
+      *aStr1 = *aStr2;
+      return aStr1;
+    }
     return static_cast<char_type*>(memcpy(aStr1, aStr2,
                                           aN * sizeof(char_type)));
   }
 
   static char_type*
   copyASCII(char_type* aStr1, const char* aStr2, size_t aN)
   {
     for (char_type* s = aStr1; aN--; ++s, ++aStr2) {
