Source-Changes-HG archive

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

[src/trunk]: src/libexec/httpd/lua Do not try and process empty requests. Thi...



details:   https://anonhg.NetBSD.org/src/rev/302c17c264a9
branches:  trunk
changeset: 322496:302c17c264a9
user:      sevan <sevan%NetBSD.org@localhost>
date:      Fri May 04 19:45:27 2018 +0000

description:
Do not try and process empty requests. This resolves a crash when issuing a
carriage return to read_request() in foreground mode.
In the C daemon, a NULL check is performed on bozo_read_request in main.c
before moving on to bozo_process_request & bozo_clean_request. Here,
process_request & clean_request just return instead.

diffstat:

 libexec/httpd/lua/glue.c |  6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (23 lines):

diff -r 8c41c9182403 -r 302c17c264a9 libexec/httpd/lua/glue.c
--- a/libexec/httpd/lua/glue.c  Fri May 04 19:11:59 2018 +0000
+++ b/libexec/httpd/lua/glue.c  Fri May 04 19:45:27 2018 +0000
@@ -155,6 +155,9 @@
        bozo_httpreq_t  *req;
 
        req = lua_touserdata(L, 1);
+       if (req == NULL) {
+               return 0;
+       }
        bozo_process_request(req);
        lua_pushnumber(L, 1);
        return 1;
@@ -167,6 +170,9 @@
        bozo_httpreq_t  *req;
 
        req = lua_touserdata(L, 1);
+       if (req == NULL) {
+               return 0;
+       }
        bozo_clean_request(req);
        lua_pushnumber(L, 1);
        return 1;



Home | Main Index | Thread Index | Old Index