summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorChristian Goetze <cg@lindenlab.com>2009-07-29 22:16:52 +0000
committerChristian Goetze <cg@lindenlab.com>2009-07-29 22:16:52 +0000
commit87776b19443030bece31c26290d1092bf6cbb3e6 (patch)
tree63977aec653de4f89ff4819908573e08fedebce1 /indra/llmessage
parent2c31217cc97938fd4bc482a888410dec59f54ddb (diff)
svn merge -r128774:128808 svn+ssh://svn.lindenlab.com/svn/user/cg/qar-1737
effective merge: svn merge -r127126:128746 svn+ssh://svn.lindenlab.com/svn/linden/branches/server/server-1.27
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llmail.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp
index d52ff6c7e8..ce206d8d7d 100644
--- a/indra/llmessage/llmail.cpp
+++ b/indra/llmessage/llmail.cpp
@@ -265,7 +265,7 @@ std::string LLMail::buildSMTPTransaction(
// static
bool LLMail::send(
const std::string& header,
- const std::string& message,
+ const std::string& raw_message,
const char* from_address,
const char* to_address)
{
@@ -276,8 +276,20 @@ bool LLMail::send(
return false;
}
- // *FIX: this translation doesn't deal with a single period on a
- // line by itself.
+ // remove any "." SMTP commands to prevent injection (DEV-35777)
+ // we don't need to worry about "\r\n.\r\n" because of the
+ // "\n" --> "\n\n" conversion going into rfc2822_msg below
+ std::string message = raw_message;
+ std::string bad_string = "\n.\n";
+ std::string good_string = "\n..\n";
+ while (1)
+ {
+ int index = message.find(bad_string);
+ if (index == std::string::npos) break;
+ message.replace(index, bad_string.size(), good_string);
+ }
+
+ // convert all "\n" into "\r\n"
std::ostringstream rfc2822_msg;
for(U32 i = 0; i < message.size(); ++i)
{