diff --git a/include/stdex/string.hpp b/include/stdex/string.hpp index 79134f8e4..a2d129d2d 100644 --- a/include/stdex/string.hpp +++ b/include/stdex/string.hpp @@ -1935,7 +1935,8 @@ namespace stdex /// This allows returned string to be fed into std::unique_ptr for auto release. /// /// \param[in] str String to duplicate. - /// \param[in] count Number of code units in str. + /// \param[in] count Number of code units in str. Duplicated string will have this number of code units allocated. + /// If str contains zero terminator, duplicated string will also be zero terminated. /// /// \return Pointer to duplicated string. Use delete[] operator to free the memory. /// @@ -1945,7 +1946,7 @@ namespace stdex _In_ size_t count) { T* dst = new T[count]; - strncpy(dst, count, str, SIZE_MAX); + strncpy(dst, count, str, count); return dst; } @@ -1955,7 +1956,8 @@ namespace stdex /// In contrast with the stdlib C strdup, the memory is allocated using operator new T[]. /// This allows returned string to be fed into std::unique_ptr for auto release. /// - /// \param[in] str String to duplicate. Must be zero-terminated. + /// \param[in] str String to duplicate. + /// If str contains zero terminator, duplicated string will also be zero terminated. /// /// \return Pointer to duplicated string; or nullptr if str is nullptr. Use delete[] operator to free the memory. ///