summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-08 07:06:57 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-08 07:06:57 +0000
commit0827a7e52ba3d957a634b063bf5a391239b9ffee (patch)
tree53a744559b70b472515a77a81bff265d9b806ea2 /lib
parente5230fba8ff9076e399dccd18ed8449fce19fd6f (diff)
* lib/net/smtp.rb (getok, get_response): raise an ArgumentError when
CR or LF is included in a line, because they are not allowed in RFC5321. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/smtp.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 250293bdbe..a7130a593b 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -926,7 +926,15 @@ module Net
private
+ def validate_line(line)
+ # A bare CR or LF is not allowed in RFC5321.
+ if /[\r\n]/ =~ line
+ raise ArgumentError, "A line must not contain CR or LF"
+ end
+ end
+
def getok(reqline)
+ validate_line reqline
res = critical {
@socket.writeline reqline
recv_response()
@@ -936,6 +944,7 @@ module Net
end
def get_response(reqline)
+ validate_line reqline
@socket.writeline reqline
recv_response()
end