]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
* socketmodule.c: fix long-standing bug in recvfrom() -- addrlen
authorGuido van Rossum <guido@python.org>
Tue, 25 May 1993 12:16:29 +0000 (12:16 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 25 May 1993 12:16:29 +0000 (12:16 +0000)
  wasn't initialized.

Modules/socketmodule.c

index 503a3594736d1a98fd5f32e27f2b57b1c290d72a..160c292d8651d0fa45948447fc275561570c5f4b 100644 (file)
@@ -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);