diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-01-19 16:39:46 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-01-19 16:39:46 +0100 |
commit | dca19b60efcdd2f5e7c22e830082242fcc7d262a (patch) | |
tree | bcdfd2e7362ae33f8b7afde94c7fbce88b14a9b6 /src | |
parent | 84dc48d1426212ed44f3df3fc88cc64cf0e0f610 (diff) |
m_alias Fix out of bounds string access that happened with certain replace strings
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_alias.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 25f071bab..32fc80b64 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -320,11 +320,11 @@ class ModuleAlias : public Module for (unsigned int i = 0; i < newline.length(); i++) { char c = newline[i]; - if (c == '$') + if ((c == '$') && (i + 1 < newline.length())) { if (isdigit(newline[i+1])) { - int len = (newline[i+2] == '-') ? 3 : 2; + int len = ((i + 2 < newline.length()) && (newline[i+2] == '-')) ? 3 : 2; std::string var = newline.substr(i, len); result.append(GetVar(var, original_line)); i += len - 1; |