diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-09-09 20:02:03 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-09-09 20:02:03 -0400 |
commit | ed7945948ed9effdc26b31edfe27799a9f6abc0d (patch) | |
tree | 102d157cc88ce25e9f9384a9e7f968212635573a /src/client.rs | |
parent | 1f00b773bb45e7c7a0c4acf3905aa2770e2f4470 (diff) | |
download | rust-irc-ed7945948ed9effdc26b31edfe27799a9f6abc0d.tar.gz rust-irc-ed7945948ed9effdc26b31edfe27799a9f6abc0d.zip |
limit messages to 512 bytes
still need to avoid actually reading in bytes past 512 in an incoming
message
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs index 3903fb7..c8f0d7b 100644 --- a/src/client.rs +++ b/src/client.rs @@ -142,6 +142,9 @@ impl Client { // \n isn't valid inside a message, so this should be fine. if the \n // we find isn't preceded by a \r, this will be caught by the message // parser. + // XXX we should only be reading 512 bytes here, and throwing an error + // otherwise - or else we could end up reading an unbounded amount of + // data into memory let buf = match self.conn().read_until(b'\n') { Ok(b) => b, Err(e) => return Err(IoError(e)), |