aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-08-31 11:41:08 +0300
committerMatti Picus <matti.picus@gmail.com>2021-08-31 11:41:08 +0300
commit6e26666f00987e85b4c54c69c2ae81f7b172c378 (patch)
tree7e7634daaee9ee94775fb8112655509c9d378ff4 /lib-python/3/smtplib.py
parentupdate to stdlib3.8.10 (diff)
downloadpypy-6e26666f00987e85b4c54c69c2ae81f7b172c378.tar.gz
pypy-6e26666f00987e85b4c54c69c2ae81f7b172c378.tar.bz2
pypy-6e26666f00987e85b4c54c69c2ae81f7b172c378.zip
update to stdlib 3.8.12
Diffstat (limited to 'lib-python/3/smtplib.py')
-rwxr-xr-xlib-python/3/smtplib.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib-python/3/smtplib.py b/lib-python/3/smtplib.py
index 4c5ba7e10d..9c390db0bf 100755
--- a/lib-python/3/smtplib.py
+++ b/lib-python/3/smtplib.py
@@ -365,10 +365,15 @@ class SMTP:
def putcmd(self, cmd, args=""):
"""Send a command to the server."""
if args == "":
- str = '%s%s' % (cmd, CRLF)
+ s = cmd
else:
- str = '%s %s%s' % (cmd, args, CRLF)
- self.send(str)
+ s = f'{cmd} {args}'
+ if '\r' in s or '\n' in s:
+ s = s.replace('\n', '\\n').replace('\r', '\\r')
+ raise ValueError(
+ f'command and arguments contain prohibited newline characters: {s}'
+ )
+ self.send(f'{s}{CRLF}')
def getreply(self):
"""Get a reply from the server.