From:
[email protected]
reopen 248946
Thankyou Mr Bug Control Robot.
On Mon, Aug 16, 2004 at 07:33:11AM -0700, Debian Bug Tracking System wrote: [trim]
that was fixed in version 2.2.1-4.3 on Fri, 27 Feb 2004 16:48:22
-0800.
No it wasn't. As described in the bug report logs, that patch only
addresses half the problem, and the supplied code examples still
generate a segfault.
The patch which I was sent for testing, but which doesn't appear to
be in the bug report history causes it to return an exception instead,
which is a much better behvaiour than segfaulting.
The working fix was written by Sebastian Schmidt <
[email protected]>,
tested successfully by me, and Matt Zimmerman <
[email protected]> said
he would produce an updated package, in an email CC'd to <
[email protected]>.
However, since this new package hasn't come into Debian yet, this bug
continues to exist.
For the record, I've included the finally agreed-on patch below:
--- python2.2-2.2.1.old/Modules/socketmodule.c Fri May 28 13:06:36 2004
+++ python2.2-2.2.1/Modules/socketmodule.c Fri May 28 13:40:06 2004
@@ -569,7 +569,7 @@
an error occurred; then an exception is raised. */
static int
-setipaddr(char* name, struct sockaddr * addr_ret, int af)
+setipaddr(char* name, struct sockaddr * addr_ret, size_t addr_ret_size, int af)
{
struct addrinfo hints, *res;
int error;
@@ -607,20 +607,12 @@
"wildcard resolved to multiple address");
return -1;
}
-#ifndef ENABLE_IPV6
- /* If IPv6 is not enabled, addr_ret has the size of
- * a struct sockaddr_in (16 bytes). getaddrinfo() may
- * return an IPv6 address which is 28 bytes long, so
- * the subsequent bytes of addr_ret get overwritten.
- * -- yath
- */
- if (res->ai_addrlen > sizeof(struct sockaddr_in)) {
+ if (res->ai_family != af || res->ai_addrlen > addr_ret_size) {
freeaddrinfo(res);
PyErr_SetString(PySocket_Error,
"unsupported address family");
ret