[libcxx] r185274 - Matthew Dempsky: Same as stdexcept.cpp in libc++abi: we've already computed 'len strlen(msg)', so we can use memcpy() instead of strcpy().

Howard Hinnant hhinnant at apple.com
Sat Jun 29 16:53:20 PDT 2013


Author: hhinnant
Date: Sat Jun 29 18:53:20 2013
New Revision: 185274

URL: http://llvm.org/viewvc/llvm-project?rev=185274&view=rev
Log:
Matthew Dempsky: Same as stdexcept.cpp in libc++abi: we've already computed 'len strlen(msg)', so we can use memcpy() instead of strcpy().

Modified:
    libcxx/trunk/src/stdexcept.cpp

Modified: libcxx/trunk/src/stdexcept.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/stdexcept.cpp?rev=185274&r1=185273&r2=185274&view=diff
==============================================================================
--- libcxx/trunk/src/stdexcept.cpp (original)
+++ libcxx/trunk/src/stdexcept.cpp Sat Jun 29 18:53:20 2013
@@ -61,7 +61,7 @@ __libcpp_nmstr::__libcpp_nmstr(const cha
     c[0] = c[1] = len;
     str_ += offset;
     count() = 0;
-    std::strcpy(const_cast<char*>(c_str()), msg);
+    std::memcpy(const_cast<char*>(c_str()), msg, len + 1);
 }
 
 inline





More information about the cfe-commits mailing list