]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/regex/v4/regex_workaround.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / regex / v4 / regex_workaround.hpp
index f245f90d4e51f717f3d26f44c017d99b61118425..35eafc253ae79455f6973d54d5e2c1e0dd88ed43 100644 (file)
@@ -198,9 +198,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
       const char *strSource 
    )
    {
-      if(std::strlen(strSource)+1 > sizeInBytes)
+         std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
+         if (lenSourceWithNull > sizeInBytes)
          return 1;
-      std::strcpy(strDestination, strSource);
+         std::memcpy(strDestination, strSource, lenSourceWithNull);
       return 0;
    }
    inline std::size_t strcat_s(
@@ -209,9 +210,11 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
       const char *strSource 
    )
    {
-      if(std::strlen(strSource) + std::strlen(strDestination) + 1 > sizeInBytes)
+         std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
+         std::size_t lenDestination = std::strlen(strDestination);
+         if (lenSourceWithNull + lenDestination > sizeInBytes)
          return 1;
-      std::strcat(strDestination, strSource);
+         std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
       return 0;
    }