gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 03/05: Detect error earlier if request HTTP version is b


From: gnunet
Subject: [libmicrohttpd] 03/05: Detect error earlier if request HTTP version is bad
Date: Tue, 26 Sep 2023 15:46:56 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit cad66b87b8dfce1cca5f0562e7653a9b8967cfce
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Sep 18 19:48:26 2023 +0300

    Detect error earlier if request HTTP version is bad
---
 src/microhttpd/connection.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index f571eb31..346b4125 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -4909,7 +4909,22 @@ get_request_line (struct MHD_Connection *c)
   const bool wsp_in_uri_keep = (-2 >= discp_lvl);
 
   if (! get_request_line_inner (c))
+  {
+    /* End of the request line has not been found yet */
+    mhd_assert ((! wsp_in_uri) || NULL == c->rq.version);
+    if ((NULL != c->rq.version) &&
+        (HTTP_VER_LEN <
+         (c->rq.hdrs.rq_line.proc_pos
+          - (size_t) (c->rq.version - c->read_buffer))))
+    {
+      c->rq.http_ver = MHD_HTTP_VER_INVALID;
+      transmit_error_response_static (c,
+                                      MHD_HTTP_BAD_REQUEST,
+                                      REQUEST_MALFORMED);
+      return true; /* Error in the request */
+    }
     return false;
+  }
   if (MHD_CONNECTION_REQ_LINE_RECEIVING < c->state)
     return true; /* Error in the request */
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]