diff --git a/ChangeLog b/ChangeLog index 396cc20..1a5355e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/upnp/src/ssdp/ssdp_server.c b/upnp/src/ssdp/ssdp_server.c index 98da4a5..354bf06 100644 --- a/upnp/src/ssdp/ssdp_server.c +++ b/upnp/src/ssdp/ssdp_server.c @@ -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, "", - sizeof(ntop_buf)); + sizeof(ntop_buf) - 1); + } UpnpPrintf(UPNP_INFO, SSDP, __FILE__, __LINE__, "Start of received response ----------------------------------------------------\n" "%s\n"