summaryrefslogtreecommitdiffstats
path: root/Lib/ftplib.py
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2017-07-26 12:11:25 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-07-26 12:11:25 (GMT)
commit8c2d4cf092c5f0335e7982392a33927579c4d512 (patch)
treee21e3b369c82c7d08eb43d134c308b9da65dcc73 /Lib/ftplib.py
parentc52cea49544621b612c7f17f45a0c2b8b61a6c67 (diff)
downloadcpython-8c2d4cf092c5f0335e7982392a33927579c4d512.zip
cpython-8c2d4cf092c5f0335e7982392a33927579c4d512.tar.gz
cpython-8c2d4cf092c5f0335e7982392a33927579c4d512.tar.bz2
[3.6] bpo-30119: fix ftplib.FTP.putline() to throw an error for a illegal command (#1214) (#2886)
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r--Lib/ftplib.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 8f36f53..a02e595 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -186,6 +186,8 @@ class FTP:
# Internal: send one line to the server, appending CRLF
def putline(self, line):
+ if '\r' in line or '\n' in line:
+ raise ValueError('an illegal newline character should not be contained')
line = line + CRLF
if self.debugging > 1:
print('*put*', self.sanitize(line))