clear addr buffer before calling getsockname

This commit is contained in:
Guido van Rossum 1996-01-12 01:36:05 +00:00
parent 71aa32f4af
commit ca42b1673b
1 changed files with 1 additions and 0 deletions

View File

@ -671,6 +671,7 @@ BUILD_FUNC_DEF_2(PySocketSock_getsockname,PySocketSockObject *,s, PyObject *,arg
return NULL; return NULL;
if (!getsockaddrlen(s, &addrlen)) if (!getsockaddrlen(s, &addrlen))
return NULL; return NULL;
memset(addrbuf, 0, addrlen);
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
res = getsockname(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); res = getsockname(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS