From 5e026e6dfb793778f9f29f5024e81716c0b4e277 Mon Sep 17 00:00:00 2001
From: 刘朕 <liuzhen@bronet.cn>
Date: Fri, 15 Nov 2019 09:27:02 +0800
Subject: [PATCH] Request漏洞修复

---
 simplewind/thinkphp/library/think/Request.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/simplewind/thinkphp/library/think/Request.php b/simplewind/thinkphp/library/think/Request.php
index 5f05b91..df21739 100644
--- a/simplewind/thinkphp/library/think/Request.php
+++ b/simplewind/thinkphp/library/think/Request.php
@@ -506,7 +506,13 @@ class Request
         } elseif (!$this->method) {
             if (isset($_POST[Config::get('var_method')])) {
                 $this->method = strtoupper($_POST[Config::get('var_method')]);
-                $this->{$this->method}($_POST);
+                if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) {
+                    $this->method = $method;
+                    $this->{$this->method}($_POST);
+                } else {
+                    $this->method = 'POST';
+                }
+                unset($_POST[Config::get('var_method')]);
             } elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
                 $this->method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
             } else {
--
libgit2 0.24.0