Use strncpy with the standard way in readFromSSDPSocket.

This commit is contained in:
Yoichi NAKAYAMA 2012-03-11 03:54:41 +09:00
parent 5944960e17
commit 04e5767ea0
2 changed files with 5 additions and 2 deletions

View File

@ -15,6 +15,7 @@ Version 1.6.16
* Respect unique_service_name error in ssdp_request_type
so as not to touch non-terminated buffer under Evt.
* Treat large argument as error in UpnpAddVirtualDir.
* Use strncpy with the standard way in readFromSSDPSocket.
* Do not clear buffer before snprintf.
* Clarify the last argument of GetDescDocumentAndURL has size LINE_SIZE.
* For inet_ntop, use buffer with size INET6_ADDRSTRLEN or INET_ADDRSTRLEN.

View File

@ -753,9 +753,11 @@ void readFromSSDPSocket(SOCKET socket)
&((struct sockaddr_in6 *)&__ss)->sin6_addr,
ntop_buf, sizeof(ntop_buf));
#endif /* UPNP_ENABLE_IPV6 */
else
else {
memset(ntop_buf, 0, sizeof(ntop_buf));
strncpy(ntop_buf, "<Invalid address family>",
sizeof(ntop_buf));
sizeof(ntop_buf) - 1);
}
UpnpPrintf(UPNP_INFO, SSDP, __FILE__, __LINE__,
"Start of received response ----------------------------------------------------\n"
"%s\n"