diff options
author | Guido van Rossum <guido@python.org> | 1993-05-25 12:16:29 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-05-25 12:16:29 (GMT) |
commit | 18c9a4f8ea85f95ba5623fc2c090bc11bae675d9 (patch) | |
tree | b8f2ebfd5f1d4ddb8d8e3a71b225947296b51510 /Modules/socketmodule.c | |
parent | 66338ec1b7a7320daa6f8cd8a8bddbd2c5dc8397 (diff) | |
download | cpython-18c9a4f8ea85f95ba5623fc2c090bc11bae675d9.zip cpython-18c9a4f8ea85f95ba5623fc2c090bc11bae675d9.tar.gz cpython-18c9a4f8ea85f95ba5623fc2c090bc11bae675d9.tar.bz2 |
* socketmodule.c: fix long-standing bug in recvfrom() -- addrlen
wasn't initialized.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 503a359..160c292 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -32,7 +32,6 @@ Limitations: - only AF_INET and AF_UNIX address families are supported - no asynchronous I/O (but read polling: avail) - no read/write operations (use send/recv or makefile instead) -- no flags on recvfrom operations - setsockopt() and getsockopt() only support integer options Interface: @@ -62,7 +61,7 @@ Socket methods: - s.listen(n) --> None - s.makefile(mode) --> file object - s.recv(nbytes [,flags]) --> string -- s.recvfrom(nbytes) --> string, sockaddr +- s.recvfrom(nbytes [,flags]) --> string, sockaddr - s.send(string [,flags]) --> None - s.sendto(string, [flags,] sockaddr) --> None - s.shutdown(how) --> None @@ -714,7 +713,11 @@ sock_recvfrom(s, args) if (!getargs(args, "(ii)", &len, &flags)) return NULL; } + if (!getsockaddrlen(s, &addrlen)) + return NULL; buf = newsizedstringobject((char *) 0, len); + if (buf == NULL) + return NULL; BGN_SAVE n = recvfrom(s->sock_fd, getstringvalue(buf), len, flags, addrbuf, &addrlen); |