diff options
Diffstat (limited to 'lib/net/smtp.rb')
-rw-r--r-- | lib/net/smtp.rb | 9 |
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 |