* socketmodule.c: fix long-standing bug in recvfrom() -- addrlen
wasn't initialized.
This commit is contained in:
parent
66338ec1b7
commit
18c9a4f8ea
|
@ -32,7 +32,6 @@ Limitations:
|
||||||
- only AF_INET and AF_UNIX address families are supported
|
- only AF_INET and AF_UNIX address families are supported
|
||||||
- no asynchronous I/O (but read polling: avail)
|
- no asynchronous I/O (but read polling: avail)
|
||||||
- no read/write operations (use send/recv or makefile instead)
|
- no read/write operations (use send/recv or makefile instead)
|
||||||
- no flags on recvfrom operations
|
|
||||||
- setsockopt() and getsockopt() only support integer options
|
- setsockopt() and getsockopt() only support integer options
|
||||||
|
|
||||||
Interface:
|
Interface:
|
||||||
|
@ -62,7 +61,7 @@ Socket methods:
|
||||||
- s.listen(n) --> None
|
- s.listen(n) --> None
|
||||||
- s.makefile(mode) --> file object
|
- s.makefile(mode) --> file object
|
||||||
- s.recv(nbytes [,flags]) --> string
|
- s.recv(nbytes [,flags]) --> string
|
||||||
- s.recvfrom(nbytes) --> string, sockaddr
|
- s.recvfrom(nbytes [,flags]) --> string, sockaddr
|
||||||
- s.send(string [,flags]) --> None
|
- s.send(string [,flags]) --> None
|
||||||
- s.sendto(string, [flags,] sockaddr) --> None
|
- s.sendto(string, [flags,] sockaddr) --> None
|
||||||
- s.shutdown(how) --> None
|
- s.shutdown(how) --> None
|
||||||
|
@ -714,7 +713,11 @@ sock_recvfrom(s, args)
|
||||||
if (!getargs(args, "(ii)", &len, &flags))
|
if (!getargs(args, "(ii)", &len, &flags))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!getsockaddrlen(s, &addrlen))
|
||||||
|
return NULL;
|
||||||
buf = newsizedstringobject((char *) 0, len);
|
buf = newsizedstringobject((char *) 0, len);
|
||||||
|
if (buf == NULL)
|
||||||
|
return NULL;
|
||||||
BGN_SAVE
|
BGN_SAVE
|
||||||
n = recvfrom(s->sock_fd, getstringvalue(buf), len, flags,
|
n = recvfrom(s->sock_fd, getstringvalue(buf), len, flags,
|
||||||
addrbuf, &addrlen);
|
addrbuf, &addrlen);
|
||||||
|
|
Loading…
Reference in New Issue