mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-29 16:53:30 +01:00
Changed use of strncpy to memcpy
This commit is contained in:
parent
699e571400
commit
a36395e2ff
@ -7,11 +7,9 @@
|
|||||||
|
|
||||||
#include "catch_stringref.h"
|
#include "catch_stringref.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstring>
|
||||||
#define _CRT_SECURE_NO_WARNINGS // Suppress warnings from MSVC about strncpy not being secure
|
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
@ -95,7 +93,7 @@ namespace Catch {
|
|||||||
void StringRef::takeOwnership() {
|
void StringRef::takeOwnership() {
|
||||||
if( !isOwned() ) {
|
if( !isOwned() ) {
|
||||||
m_data = new char[m_size+1];
|
m_data = new char[m_size+1];
|
||||||
strncpy( m_data, m_start, m_size );
|
memcpy( m_data, m_start, m_size );
|
||||||
m_data[m_size] = '\0';
|
m_data[m_size] = '\0';
|
||||||
m_start = m_data;
|
m_start = m_data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user