summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibuv/src/inet.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-16 20:00:33 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-17 15:26:32 (GMT)
commit1e1209729b26312cb511d5995bd57b6f5d35235e (patch)
tree8fb1927e363a9278f103a9a70a5a7923d398cbaf /Utilities/cmlibuv/src/inet.c
parentc59eae7ebc5423c2b06befd762f8639b0f23b7a0 (diff)
parent4fcb0d0213112bb2fdb04bb27e82543b93cfe41d (diff)
downloadCMake-1e1209729b26312cb511d5995bd57b6f5d35235e.zip
CMake-1e1209729b26312cb511d5995bd57b6f5d35235e.tar.gz
CMake-1e1209729b26312cb511d5995bd57b6f5d35235e.tar.bz2
Merge branch 'upstream-libuv' into update-libuv
* upstream-libuv: libuv 2019-01-15 (f84c5e69)
Diffstat (limited to 'Utilities/cmlibuv/src/inet.c')
-rw-r--r--Utilities/cmlibuv/src/inet.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/Utilities/cmlibuv/src/inet.c b/Utilities/cmlibuv/src/inet.c
index 7c75e43..58238dc 100644
--- a/Utilities/cmlibuv/src/inet.c
+++ b/Utilities/cmlibuv/src/inet.c
@@ -22,7 +22,7 @@
#include <string.h>
#if defined(_MSC_VER) && _MSC_VER < 1600
-# include "stdint-msvc2008.h"
+# include "uv/stdint-msvc2008.h"
#else
# include <stdint.h>
#endif
@@ -59,8 +59,7 @@ static int inet_ntop4(const unsigned char *src, char *dst, size_t size) {
if (l <= 0 || (size_t) l >= size) {
return UV_ENOSPC;
}
- strncpy(dst, tmp, size);
- dst[size - 1] = '\0';
+ uv__strscpy(dst, tmp, size);
return 0;
}
@@ -142,14 +141,8 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) {
if (best.base != -1 && (best.base + best.len) == ARRAY_SIZE(words))
*tp++ = ':';
*tp++ = '\0';
-
- /*
- * Check for overflow, copy, and we're done.
- */
- if ((size_t)(tp - tmp) > size) {
+ if (UV_E2BIG == uv__strscpy(dst, tmp, size))
return UV_ENOSPC;
- }
- strcpy(dst, tmp);
return 0;
}