diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2013-02-27 15:31:20 -0800 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2013-02-27 15:31:20 -0800 |
commit | 37d0247301cafe1cf683cc7b3edb95dc6b30caac (patch) | |
tree | 8636e8e878c8e1a1fec5290e94eb12b7043201d4 | |
parent | e761502e8ec5958c27228006314e423057ff8c9d (diff) | |
parent | 3bbcf808d8da43a379cee5ce3d004d3c6eb6e1b7 (diff) |
Merge pull request #116 from mvschaik/patch-1
Limit memory allocation of get_bytes to 1MB
-rw-r--r-- | paramiko/message.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/paramiko/message.py b/paramiko/message.py index 366c43c9..47acc34b 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -110,7 +110,8 @@ class Message (object): @rtype: string """ b = self.packet.read(n) - if len(b) < n: + max_pad_size = 1<<20 # Limit padding to 1 MB + if len(b) < n and n < max_pad_size: return b + '\x00' * (n - len(b)) return b |