Mercurial > public > mercurial-scm > hg-stable
diff mercurial/pycompat.py @ 43021:2cc453284d5c
patchbomb: protect email addresses from shell
When patchbomb sends email via a sendmail-like program it invokes this
using procutil.popen which passes the string to a shell to be parsed.
To protect any special characters in the email addresses on the
command line from being interpretered by the shell they must be
quoted.
author | Floris Bruynooghe <flub@google.com> |
---|---|
date | Mon, 30 Sep 2019 00:01:58 +0200 |
parents | 1b49b84d5ed5 |
children | 2372284d9457 |
line wrap: on
line diff
--- a/mercurial/pycompat.py Sun Sep 29 11:29:25 2019 -0700 +++ b/mercurial/pycompat.py Mon Sep 30 00:01:58 2019 +0200 @@ -328,8 +328,11 @@ ret = shlex.split(s.decode('latin-1'), comments, posix) return [a.encode('latin-1') for a in ret] + shlexquote = shlex.quote + else: import cStringIO + import pipes xrange = xrange unicode = unicode @@ -393,6 +396,7 @@ sysplatform = sys.platform sysexecutable = sys.executable shlexsplit = shlex.split + shlexquote = pipes.quote bytesio = cStringIO.StringIO stringio = bytesio maplist = map