Merge pull request #6001 from rgerhards/fix-posisble-garbagge

core/nsd_ptcp: zero addr before getpeername()
This commit is contained in:
Rainer Gerhards 2025-08-21 17:48:35 +02:00 committed by GitHub
commit a462eb22d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1036,6 +1036,7 @@ static rsRetVal GetRemotePort(nsd_t *pNsd, int *port) {
assert(port != NULL);
*port = -1; /* Initialize port to -1, indicating no port found initially or on error */
memset(&addr, 0, sizeof(addr)); /* avoid potential garbage values */
if (getpeername(pThis->sock, (struct sockaddr *)&addr, &addrlen) == 0) {
if (addr.ss_family == AF_INET6) {