diff options
author | Ned Deily <nad@acm.org> | 2014-07-13 05:01:15 (GMT) |
---|---|---|
committer | Ned Deily <nad@acm.org> | 2014-07-13 05:01:15 (GMT) |
commit | c89376292efeddb56ffc34474bbd6b8fd45ca31f (patch) | |
tree | 96175fe37c1139657435e7a8cd442ba78dd0bddd /Lib/CGIHTTPServer.py | |
parent | f2892879a0e383ca8e2031fe4e05d490bd1463a8 (diff) | |
download | cpython-c89376292efeddb56ffc34474bbd6b8fd45ca31f.zip cpython-c89376292efeddb56ffc34474bbd6b8fd45ca31f.tar.gz cpython-c89376292efeddb56ffc34474bbd6b8fd45ca31f.tar.bz2 |
Issue #21323: Fix CGIHTTPServer to again handle scripts in CGI subdirectories,
broken by the fix for security issue #19435. Patch by Zach Byrne.
Diffstat (limited to 'Lib/CGIHTTPServer.py')
-rw-r--r-- | Lib/CGIHTTPServer.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py index 2acf913..8f8ae56 100644 --- a/Lib/CGIHTTPServer.py +++ b/Lib/CGIHTTPServer.py @@ -106,16 +106,16 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info - - i = rest.find('/') + path = dir + '/' + rest + i = path.find('/', len(dir)+1) while i >= 0: - nextdir = rest[:i] - nextrest = rest[i+1:] + nextdir = path[:i] + nextrest = path[i+1:] scriptdir = self.translate_path(nextdir) if os.path.isdir(scriptdir): dir, rest = nextdir, nextrest - i = rest.find('/') + i = path.find('/', len(dir)+1) else: break |