summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2008-02-23 19:28:58 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2008-02-23 19:28:58 (GMT)
commit1beea27299b836fd9194b769f2f79913ed20219e (patch)
tree7a0531d6287a5b25463c85022ad0a52b715d02be /Lib/socket.py
parent1219a8098965109a112a4732f8f3b78a00a68bae (diff)
downloadcpython-1beea27299b836fd9194b769f2f79913ed20219e.zip
cpython-1beea27299b836fd9194b769f2f79913ed20219e.tar.gz
cpython-1beea27299b836fd9194b769f2f79913ed20219e.tar.bz2
#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 6b4b743..2ca8ff6 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -328,7 +328,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