diff options
author | George Hazan <george.hazan@gmail.com> | 2015-04-11 18:38:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-04-11 18:38:15 +0000 |
commit | 27c63813af1433d827335b5d1d34c2b70eddeb6b (patch) | |
tree | 00c17e3d2e4c378a99dbdb5655039aced63430c4 /src/modules/netlib | |
parent | 6651124419887cafa9b3ecda6a3e479a477e4077 (diff) |
strcpy() calls replaced with strncpy_s()
git-svn-id: http://svn.miranda-ng.org/main/trunk@12772 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib')
-rw-r--r-- | src/modules/netlib/netlibsock.cpp | 13 | ||||
-rw-r--r-- | src/modules/netlib/netlibupnp.cpp | 3 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp index 4bc3be12f4..e53e73bd89 100644 --- a/src/modules/netlib/netlibsock.cpp +++ b/src/modules/netlib/netlibsock.cpp @@ -275,11 +275,11 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags) SOCKADDR_INET_M *iaddr = (SOCKADDR_INET_M*)ai->ai_addr;
if (ai->ai_family == AF_INET ||
(ai->ai_family == AF_INET6 &&
- (!(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr)))) {
-
- char* szIp = NetlibAddressToString(iaddr);
+ (!(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
+ {
+ char *szIp = NetlibAddressToString(iaddr);
if (szIp)
- strcpy(addr->szIp[i++], szIp);
+ strncpy_s(addr->szIp[i++], szIp, _TRUNCATE);
mir_free(szIp);
}
}
@@ -295,13 +295,14 @@ static NETLIBIPLIST* GetMyIpv4(void) PHOSTENT he = gethostbyname(hostname);
unsigned n;
- for (n = 0; he->h_addr_list[n]; ++n);
+ for (n = 0; he->h_addr_list[n]; ++n)
+ ;
NETLIBIPLIST *addr = (NETLIBIPLIST*)mir_calloc(n * 64 + 4);
addr->cbNum = n;
for (unsigned i = 0; i < n; i++)
- strcpy(addr->szIp[i], inet_ntoa(*(PIN_ADDR)he->h_addr_list[i]));
+ strncpy_s(addr->szIp[i], inet_ntoa(*(PIN_ADDR)he->h_addr_list[i]), _TRUNCATE);
return addr;
}
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 4e6813b8c9..513aafaa55 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -343,7 +343,8 @@ retrycon: break;
}
}
- strcpy(szConnHost, szHost); sConnPort = sPort;
+ strncpy_s(szConnHost, szHost, _TRUNCATE);
+ sConnPort = sPort;
}
if (send(sock, szData, sz, 0) != SOCKET_ERROR) {
|