summaryrefslogtreecommitdiff
path: root/Lib/socket.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2008-02-23 19:30:59 +0000
committerAndrew M. Kuchling <amk@amk.ca>2008-02-23 19:30:59 +0000
commit664553a778dd10a854c554d309c78de012813629 (patch)
tree6a74677717ba7f1c2a270a67c201d1dad0d09774 /Lib/socket.py
parent37d4f7bc0c3b9c6e2bd858873c691c9d2bf091ae (diff)
downloadcpython-git-664553a778dd10a854c554d309c78de012813629.tar.gz
#1389051, #1092502: fix excessively large allocations when using read() on a socket
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 0082e7656e..f79b28268d 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -305,7 +305,7 @@ class _fileobject(object):
self._rbuf = ""
while True:
left = size - buf_len
- recv_size = max(self._rbufsize, left)
+ recv_size = min(self._rbufsize, left)
data = self._sock.recv(recv_size)
if not data:
break