summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host/common')
-rw-r--r--lldb/source/Host/common/FileSpec.cpp6
-rw-r--r--lldb/source/Host/common/SocketAddress.cpp6
2 files changed, 4 insertions, 8 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index 553764e560d..a968dd93b61 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -793,10 +793,8 @@ FileSpec::GetPath(char *path, size_t path_max_len, bool denormalize) const
return 0;
std::string result = GetPath(denormalize);
-
- size_t result_length = std::min(path_max_len-1, result.length());
- ::strncpy(path, result.c_str(), result_length + 1);
- return result_length;
+ ::snprintf(path, path_max_len, "%s", result.c_str());
+ return std::min(path_max_len-1, result.length());
}
std::string
diff --git a/lldb/source/Host/common/SocketAddress.cpp b/lldb/source/Host/common/SocketAddress.cpp
index b6a7a08bb3a..3ab6cfeec4a 100644
--- a/lldb/source/Host/common/SocketAddress.cpp
+++ b/lldb/source/Host/common/SocketAddress.cpp
@@ -48,8 +48,7 @@ const char* inet_ntop(int af, const void * src,
const char* formatted = inet_ntoa(*static_cast<const in_addr*>(src));
if (formatted && strlen(formatted) < size)
{
- strncpy(dst, formatted, size);
- return dst;
+ return ::strcpy(dst, formatted);
}
}
return nullptr;
@@ -64,8 +63,7 @@ const char* inet_ntop(int af, const void * src,
);
if (full_size < static_cast<int>(size))
{
- strncpy(dst,tmp,size);
- return dst;
+ return ::strcpy(dst, tmp);
}
return nullptr;
}
OpenPOWER on IntegriCloud