Added a bounds check on handle_ctcp.

This commit is contained in:
Aaron Weiss 2016-04-11 22:59:20 -04:00
parent 79afdeb134
commit 85e30e6f9f
No known key found for this signature in database
GPG key ID: 0237035D9BF03AE2

View file

@ -399,6 +399,7 @@ impl IrcServer {
/// Handles CTCP requests if the CTCP feature is enabled. /// Handles CTCP requests if the CTCP feature is enabled.
#[cfg(feature = "ctcp")] #[cfg(feature = "ctcp")]
fn handle_ctcp(&self, resp: &str, tokens: Vec<&str>) -> Result<()> { fn handle_ctcp(&self, resp: &str, tokens: Vec<&str>) -> Result<()> {
if (tokens.len() == 0) { return Ok(()) }
match tokens[0] { match tokens[0] {
"FINGER" => self.send_ctcp_internal(resp, &format!( "FINGER" => self.send_ctcp_internal(resp, &format!(
"FINGER :{} ({})", self.config().real_name(), self.config().username() "FINGER :{} ({})", self.config().real_name(), self.config().username()