aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Cgi/private.py
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2016-07-14 14:27:49 -0700
committerMark Sapiro <mark@msapiro.net>2016-07-14 14:27:49 -0700
commit6efea059931995de8713f35bccc1116905175cf2 (patch)
tree6f7933394fc09ef5e495b24a558ca9c2a5f983f0 /Mailman/Cgi/private.py
parentde6ffbe5a0ce37751247b071b75aa7c8e6605c58 (diff)
downloadmailman2-6efea059931995de8713f35bccc1116905175cf2.tar.gz
mailman2-6efea059931995de8713f35bccc1116905175cf2.tar.xz
mailman2-6efea059931995de8713f35bccc1116905175cf2.zip
Catch TypeError from certain defective crafted POST requests.
Diffstat (limited to '')
-rwxr-xr-xMailman/Cgi/private.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Mailman/Cgi/private.py b/Mailman/Cgi/private.py
index 36cacee4..0f7597a2 100755
--- a/Mailman/Cgi/private.py
+++ b/Mailman/Cgi/private.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2014 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -118,7 +118,16 @@ def main():
doc.set_language(mlist.preferred_language)
cgidata = cgi.FieldStorage()
- username = cgidata.getvalue('username', '')
+ try:
+ username = cgidata.getvalue('username', '')
+ except TypeError:
+ # Someone crafted a POST with a bad Content-Type:.
+ doc.AddItem(Header(2, _("Error")))
+ doc.AddItem(Bold(_('Invalid options to CGI script.')))
+ # Send this with a 400 status.
+ print 'Status: 400 Bad Request'
+ print doc.Format()
+ return
password = cgidata.getvalue('password', '')
is_auth = 0