From patchwork Mon Nov 30 16:33:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 106558 Received: from mail-dl1-f47.google.com (mail-dl1-f47.google.com [74.125.82.47]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36161.1796056387930570865 for ; Mon, 30 Nov 2026 08:33:08 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=JrUVVz3q; spf=pass (domain: gmail.com, ip: 74.125.82.47, mailfrom: raj.khem@gmail.com) Received: by mail-dl1-f47.google.com with SMTP id a92af1059eb24-14394530ec6so5760167c88.1 for ; Mon, 30 Nov 2026 08:33:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796056387; x=1796661187; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gbg1+LlfiAnWsp8MeU50ZrALOj9erwinObM/FCESgbk=; b=JrUVVz3qcFlobo9T3fDnCVqWeg/3CYeOvA/pkkVExP3bWjFWtDizK3zUimzCDbVvcF Qu9z3h9uUm/JVOvyFcILT0bc7eWm1p441MpBbGaQAC7Av9o57c+FprhsCOpkICYCgMHY W8TI9YuU/3n5kL+8dlFk5kFWqw3ct1+K3AZttSLeSsn10Hv8K0zSEfsAY7rfj07v95Cd G2XeEk9DZTnxq8qiu0A9mV89F/ZqE+3lmq8QFMjV4Kvq4tHeyqNq5XWgS8Cosspsf1sj zDHuAqKfbyRQv92OsWwTkpnsu9pT72bTMK1/By59clqkvjzcYIGRS9N/Tp0KMDM+dvUC mlLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796056387; x=1796661187; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=gbg1+LlfiAnWsp8MeU50ZrALOj9erwinObM/FCESgbk=; b=SVwnOyQh7t/tbVpjefYpzl7rfJ74y/MCGAvNg7JksjvF4kMI3rOso1f68Uaf0omAnx Y1oG4NSuvZzC6YlDQfZJFazR+yGiLmB0FSTEJgRmgeJG/bo2MEv15JU48LDmkwQ9I3VX KLNOm4vXcxIsVjd0rzn3C+NpEELmSDo2TVod3NNxoWf1qSnNFj1cwkqvdjE9NrUxNrrm P9a2xMMdMPWCpYSA1rdBMOgMHBTyxXb9DtoNLub9U/CdjipMoqU9n8U319+NiS2WvIni ZQxLytE2ons1ugVYThjH1dc/niH3SL83QSd7plARMi5ufGp2K46LOpVblXwgDGa6trIm /Spg== X-Gm-Message-State: APuU4Z8fZGuKHuJ6DA60wY+/NAzFR3y1/ts7Ujrm1uU6wZR+h2dnUqB2 Lz4/RnwQXIOF9yQY1K5FkqzrWvE9OELib78trmZRoE7cGSXm/45FJdlcSm3MA+lc X-Gm-Gg: AZFdTZemNfbKXhyXCn0I/0hq4SrC0b/I5uD+h8gRN6ECS2WiGUs/Igq+swvzkdtLIww AHkz1uErNAq4tKW9R4KNiKWdHSFtpWN0bjHmXlSx2mMLQrKs57wN5c5j+poqQCn6VMfjcSLFrbV jGcOS3OqYe4QdAKqDheu7coMgOJ5DocbSJAx05i26qCsCnj6Ayb0JYliiHD5V11XVyip6O0hvgZ pvI+2/T2BQsQEjrL/zpmNcF9ydJH21TCEX7+9p2jJbbfBfS3aWXNU1YjLjvyvwUj4lVpRYB/38M XgKxXKvrregjAzWBuqGXOO5GqhVDV4dFVWBBkBvEy2yUSOkYHJ9N4KaFV+ZOpULt9o4cw+XwCeX yfO+hJtPRxQdJUOs0cetweRaVDf+UeWkSmPPkfO1PkGGO+vk0esgj8WcC7usxJKyJ+td3OJqbmZ xmsws/ZCBMTKIVXL74Kh6DcIG9XONtqHsR/gysF9kcp98kaMWlq+GRaeImGq3uHhkgRKqImQBsZ 019OJLVIiuzku5YEVR1OpQmlhO5bt1bibtFFWc+QQMMY/Q5qU4qvJkoX15M5AMXUfyKOiAfFr0K 8JjfiBTOYehuWBzu08kM/7OHvD2ZfyZtMM59rKa/NcLLKTTYQNJOThOdNUTev9OoLspUrydj/BL 8Yf4ujsSokk4K6cPDjQaOfiUHvRV9CMqB1krU6V2hREBjmH77rqG8KjSayG2HdSXvbmX9PwHTja WNZynnrg9U+iMPe+xqF2Gn30lRKenLmuYs/Bqdv/XdwAzOd4ovlOMdShUwiAL8MkdxSdA1OooyF K+jXEQCWvL5tmN8zxEd0YlIpRwGNtS0ru2+lD7gp5rXgrc1iXW74E3Yy8cR5RGAFGIhxrm1R/0g HogP X-Received: by 2002:a05:7022:1187:b0:1b5:31e4:9970 with SMTP id a92af1059eb24-1b55689ee2dmr33888323c88.8.1796056386845; Mon, 30 Nov 2026 08:33:06 -0800 (PST) Return-Path: Received: from apollo.tail3ccdd3.ts.net ([147.160.63.35]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5569bffd2sm73850769c88.0.2026.11.30.08.33.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 08:33:06 -0800 (PST) From: Khem Raj X-Google-Original-From: Khem Raj To: openembedded-devel@lists.openembedded.org Cc: Khem Raj Subject: [meta-webserver][PATCH 3/4] monkey: Upgrade 1.8.7 -> 1.8.10 Date: Mon, 30 Nov 2026 08:33:00 -0800 Message-ID: <20261130163301.1629894-4-khem.raj@oss.qualcomm.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261130163301.1629894-1-khem.raj@oss.qualcomm.com> References: <20261130163301.1629894-1-khem.raj@oss.qualcomm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 16:33:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/133573 - 1.8.8: fixes crashes on malformed requests, guards the protocol close callback and hardens parser boundary checks (the three patches carried here), escapes reflected URIs in HTML pages, accepts empty header values and bounds Content-Length parsing; moves the network transport into the core with OpenSSL and mbedTLS TLS backends. - 1.8.9: RISC-V64 coroutine support in flb_libco, native Windows socket pairs. - 1.8.10: Emscripten event and timer support and timeout worker fixes. Drop 0001-server-http-fix-malformed-request-crash-paths.patch, 0002-server-scheduler-guard-protocol-close-callback.patch and 0003-server-parser-harden-boundary-checks.patch, which are in 1.8.8. Packaging changes for 1.8.8 and later: - configure now runs file(MAKE_DIRECTORY) on MK_PATH_CONF, which fails for /etc/monkey; add 0001-build-Only-create-runtime-directories-inside-the-bui.patch so only the in-tree defaults are created. - MK_PATH_PIDPATH and MK_PATH_WWW now default to build tree paths (they were empty before, giving "PidFile /monkey.pid" and an empty DocumentRoot); set them to /run and ${datadir}/monkey/htdocs, and drop the empty /run from the image. - TLS support is now in the core and links OpenSSL when it is found in the sysroot. Add a "tls" PACKAGECONFIG (off by default, as before) that selects the OpenSSL backend. - Upstream generates monkey.conf, monkey.mime, plugins.load and sites/default but never installed them; install them to ${sysconfdir}/monkey, where CONFFILES already expects them. The recipe fetches release tags, so check for new tags instead of new commits. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj --- ...e-runtime-directories-inside-the-bui.patch | 41 +++++ ...tp-fix-malformed-request-crash-paths.patch | 160 ------------------ ...eduler-guard-protocol-close-callback.patch | 51 ------ ...server-parser-harden-boundary-checks.patch | 108 ------------ .../{monkey_1.8.7.bb => monkey_1.8.10.bb} | 19 ++- 5 files changed, 54 insertions(+), 325 deletions(-) create mode 100644 meta-webserver/recipes-httpd/monkey/files/0001-build-Only-create-runtime-directories-inside-the-bui.patch delete mode 100644 meta-webserver/recipes-httpd/monkey/files/0001-server-http-fix-malformed-request-crash-paths.patch delete mode 100644 meta-webserver/recipes-httpd/monkey/files/0002-server-scheduler-guard-protocol-close-callback.patch delete mode 100644 meta-webserver/recipes-httpd/monkey/files/0003-server-parser-harden-boundary-checks.patch rename meta-webserver/recipes-httpd/monkey/{monkey_1.8.7.bb => monkey_1.8.10.bb} (85%) diff --git a/meta-webserver/recipes-httpd/monkey/files/0001-build-Only-create-runtime-directories-inside-the-bui.patch b/meta-webserver/recipes-httpd/monkey/files/0001-build-Only-create-runtime-directories-inside-the-bui.patch new file mode 100644 index 0000000000..a5d1c6202b --- /dev/null +++ b/meta-webserver/recipes-httpd/monkey/files/0001-build-Only-create-runtime-directories-inside-the-bui.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 28 Nov 2026 17:14:14 -0800 +Subject: [PATCH] build: Only create runtime directories inside the build tree + +Since the TLS backend rework, configure runs file(MAKE_DIRECTORY) on +MK_PATH_CONF, MK_PATH_LOG and MK_PATH_PIDPATH. With install paths such +as -DMK_PATH_CONF=/etc/monkey this tries to create /etc/monkey on the +build host and fails when configuring as a normal user or for a +cross-compiled target. The install rules already create these +directories, so only pre-create the default ones under the build +directory. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 340e634..40af6a2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -249,9 +249,14 @@ set(MK_PATH_PIDPATH "${PROJECT_BINARY_DIR}/run" CACHE PATH + set(MK_PATH_WWW "${PROJECT_SOURCE_DIR}/htdocs" CACHE PATH + "Default Monkey document root") + +-file(MAKE_DIRECTORY "${MK_PATH_CONF}") +-file(MAKE_DIRECTORY "${MK_PATH_LOG}") +-file(MAKE_DIRECTORY "${MK_PATH_PIDPATH}") ++# Only pre-create the default in-tree directories; installed paths such as ++# /etc/monkey are created by the install rules. ++foreach(path "${MK_PATH_CONF}" "${MK_PATH_LOG}" "${MK_PATH_PIDPATH}") ++ string(FIND "${path}" "${PROJECT_BINARY_DIR}" pos) ++ if(pos EQUAL 0) ++ file(MAKE_DIRECTORY "${path}") ++ endif() ++endforeach() + + # Default values for conf/monkey.conf + set(MK_CONF_LISTEN "2001") diff --git a/meta-webserver/recipes-httpd/monkey/files/0001-server-http-fix-malformed-request-crash-paths.patch b/meta-webserver/recipes-httpd/monkey/files/0001-server-http-fix-malformed-request-crash-paths.patch deleted file mode 100644 index b57d7ac219..0000000000 --- a/meta-webserver/recipes-httpd/monkey/files/0001-server-http-fix-malformed-request-crash-paths.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 839620179e2b4e5982c53d8956d92e690d82960c Mon Sep 17 00:00:00 2001 -From: Eduardo Silva -Date: Thu, 9 Apr 2026 12:11:52 -0600 -Subject: [PATCH] server: http: fix malformed request crash paths - -Fix the reproducible malformed-request crash paths in the HTTP -request lifecycle. - -Handle missing Host data in directory redirects, reject malformed -range delimiters before substring parsing, and avoid reusing invalid -request state while advancing pipelined requests. - -Verified by rebuilding with cmake --build build and replaying the -reported crash-inducing request fixtures against build/bin/monkey. - -Signed-off-by: Eduardo Silva - -This patch is part of https://github.com/monkey/monkey/pull/434, -containing assorted CVE fixes. - -Upstream-Status: Backport [https://github.com/monkey/monkey/commit/1570f41231888ae8c7fbd719704e2486a952e45d] -Signed-off-by: Gyorgy Sarvari ---- - mk_core/mk_memory.c | 10 ++++++++++ - mk_server/mk_http.c | 46 +++++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 52 insertions(+), 4 deletions(-) - -diff --git a/mk_core/mk_memory.c b/mk_core/mk_memory.c -index c4073e23..008f7ac6 100644 ---- a/mk_core/mk_memory.c -+++ b/mk_core/mk_memory.c -@@ -52,6 +52,16 @@ char *mk_ptr_to_buf(mk_ptr_t p) - { - char *buf; - -+ if (!p.data || p.len == 0) { -+ buf = mk_mem_alloc(1); -+ if (!buf) { -+ return NULL; -+ } -+ -+ buf[0] = '\0'; -+ return buf; -+ } -+ - buf = mk_mem_alloc(p.len + 1); - if (!buf) return NULL; - -diff --git a/mk_server/mk_http.c b/mk_server/mk_http.c -index ad12a74a..f2f12554 100644 ---- a/mk_server/mk_http.c -+++ b/mk_server/mk_http.c -@@ -457,6 +457,10 @@ static int mk_http_range_parse(struct mk_http_request *sr) - if ((sep_pos = mk_string_char_search(sr->range.data, '-', sr->range.len)) < 0) - return -1; - -+ if (sep_pos < eq_pos) { -+ return -1; -+ } -+ - len = sr->range.len; - sh = &sr->headers; - -@@ -476,10 +480,16 @@ static int mk_http_range_parse(struct mk_http_request *sr) - /* =yyy-xxx */ - if ((eq_pos + 1 != sep_pos) && (len > sep_pos + 1)) { - buffer = mk_string_copy_substr(sr->range.data, eq_pos + 1, sep_pos); -+ if (!buffer) { -+ return -1; -+ } - sh->ranges[0] = (unsigned long) atol(buffer); - mk_mem_free(buffer); - - buffer = mk_string_copy_substr(sr->range.data, sep_pos + 1, len); -+ if (!buffer) { -+ return -1; -+ } - sh->ranges[1] = (unsigned long) atol(buffer); - mk_mem_free(buffer); - -@@ -493,6 +503,9 @@ static int mk_http_range_parse(struct mk_http_request *sr) - /* =yyy- */ - if ((eq_pos + 1 != sep_pos) && (len == sep_pos + 1)) { - buffer = mk_string_copy_substr(sr->range.data, eq_pos + 1, len); -+ if (!buffer) { -+ return -1; -+ } - sr->headers.ranges[0] = (unsigned long) atol(buffer); - mk_mem_free(buffer); - -@@ -522,7 +535,16 @@ static int mk_http_directory_redirect_check(struct mk_http_session *cs, - return 0; - } - -+ if (!sr->host.data || sr->host.len <= 0) { -+ mk_http_error(MK_CLIENT_BAD_REQUEST, cs, sr, server); -+ return -1; -+ } -+ - host = mk_ptr_to_buf(sr->host); -+ if (!host) { -+ mk_http_error(MK_CLIENT_BAD_REQUEST, cs, sr, server); -+ return -1; -+ } - - /* - * Add ending slash to the location string -@@ -588,6 +610,9 @@ static inline char *mk_http_index_lookup(mk_ptr_t *path_base, - } - - off = path_base->len; -+ if ((size_t) off >= buf_size) { -+ return NULL; -+ } - memcpy(buf, path_base->data, off); - - mk_list_foreach(head, server->index_files) { -@@ -1138,15 +1163,27 @@ int mk_http_request_end(struct mk_http_session *cs, struct mk_server *server) - ret = mk_http_parser_more(&cs->parser, cs->body_length); - if (ret == MK_TRUE) { - /* Our pipeline request limit is the same that our keepalive limit */ -+ if (cs->parser.i < 0 || -+ (unsigned int) (cs->parser.i + 1) >= cs->body_length) { -+ goto shutdown; -+ } -+ - cs->counter_connections++; - len = (cs->body_length - cs->parser.i) -1; -+ if (len <= 0) { -+ goto shutdown; -+ } - memmove(cs->body, - cs->body + cs->parser.i + 1, - len); - cs->body_length = len; - - /* Prepare for next one */ -- sr = mk_list_entry_first(&cs->request_list, struct mk_http_request, _head); -+ if (mk_list_is_empty(&cs->request_list) == 0) { -+ cs->close_now = MK_TRUE; -+ goto shutdown; -+ } -+ sr = &cs->sr_fixed; - mk_http_request_free(sr, server); - mk_http_request_init(cs, sr, server); - mk_http_parser_init(&cs->parser); -@@ -1626,9 +1663,10 @@ int mk_http_sched_done(struct mk_sched_conn *conn, - struct mk_http_request *sr; - - session = mk_http_session_get(conn); -- sr = mk_list_entry_first(&session->request_list, -- struct mk_http_request, _head); -- mk_plugin_stage_run_40(session, sr, server); -+ if (mk_list_is_empty(&session->request_list) != 0) { -+ sr = &session->sr_fixed; -+ mk_plugin_stage_run_40(session, sr, server); -+ } - - return mk_http_request_end(session, server); - } diff --git a/meta-webserver/recipes-httpd/monkey/files/0002-server-scheduler-guard-protocol-close-callback.patch b/meta-webserver/recipes-httpd/monkey/files/0002-server-scheduler-guard-protocol-close-callback.patch deleted file mode 100644 index c731db0919..0000000000 --- a/meta-webserver/recipes-httpd/monkey/files/0002-server-scheduler-guard-protocol-close-callback.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 82fb537e74e9b801d196b76efaf735ee50cd86c6 Mon Sep 17 00:00:00 2001 -From: Eduardo Silva -Date: Thu, 9 Apr 2026 12:43:31 -0600 -Subject: [PATCH] server: scheduler: guard protocol close callback - -Avoid calling a null cb_close handler from the scheduler close -and timeout paths. - -This fixes the HTTP/2 upgrade case where the protocol handler can be -switched to mk_http2_handler even though that handler does not -implement cb_close. - -Verified by rebuilding with cmake --build build. - -Signed-off-by: Eduardo Silva - -This patch is part of https://github.com/monkey/monkey/pull/434, -containing assorted CVE fixes. - -Upstream-Status: Backport [https://github.com/monkey/monkey/commit/fc1d68fb38044df08cb43c7d9af0f68714388efc] -Signed-off-by: Gyorgy Sarvari ---- - mk_server/mk_scheduler.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/mk_server/mk_scheduler.c b/mk_server/mk_scheduler.c -index a680d3cd..3cf0ba40 100644 ---- a/mk_server/mk_scheduler.c -+++ b/mk_server/mk_scheduler.c -@@ -598,8 +598,10 @@ int mk_sched_check_timeouts(struct mk_sched_worker *sched, - MK_TRACE("Scheduler, closing fd %i due TIMEOUT", - conn->event.fd); - MK_LT_SCHED(conn->event.fd, "TIMEOUT_CONN_PENDING"); -- conn->protocol->cb_close(conn, sched, MK_SCHED_CONN_TIMEOUT, -- server); -+ if (conn->protocol->cb_close) { -+ conn->protocol->cb_close(conn, sched, MK_SCHED_CONN_TIMEOUT, -+ server); -+ } - mk_sched_drop_connection(conn, sched, server); - } - } -@@ -749,7 +751,7 @@ int mk_sched_event_close(struct mk_sched_conn *conn, - MK_TRACE("[FD %i] Connection Handler, closed", conn->event.fd); - mk_event_del(sched->loop, &conn->event); - -- if (type != MK_EP_SOCKET_DONE) { -+ if (type != MK_EP_SOCKET_DONE && conn->protocol->cb_close) { - conn->protocol->cb_close(conn, sched, type, server); - } - /* diff --git a/meta-webserver/recipes-httpd/monkey/files/0003-server-parser-harden-boundary-checks.patch b/meta-webserver/recipes-httpd/monkey/files/0003-server-parser-harden-boundary-checks.patch deleted file mode 100644 index 1e56893c65..0000000000 --- a/meta-webserver/recipes-httpd/monkey/files/0003-server-parser-harden-boundary-checks.patch +++ /dev/null @@ -1,108 +0,0 @@ -From b9f24a2968fa62de4a6ecf070fa0389ce10e7729 Mon Sep 17 00:00:00 2001 -From: Eduardo Silva -Date: Thu, 9 Apr 2026 12:11:57 -0600 -Subject: [PATCH] server: parser: harden boundary checks - -Tighten parser and helper validation around explicit lengths and -buffer boundaries. - -Require exact header literal matches, validate chunk length tokens, -and guard helper routines that previously trusted inconsistent -pointer or length state. - -Verified by rebuilding with cmake --build build and replaying the -reported malformed request fixtures against build/bin/monkey. - -Signed-off-by: Eduardo Silva - -This patch is part of https://github.com/monkey/monkey/pull/434, -containing assorted CVE fixes. - -Upstream-Status: Backport [https://github.com/monkey/monkey/commit/ffe0d0ed1b074ea6f3965c37bb754e9f19130a82] -Signed-off-by: Gyorgy Sarvari ---- - include/monkey/mk_http_parser.h | 6 +++++- - mk_server/mk_http_parser.c | 13 +++++++++++++ - mk_server/mk_mimetype.c | 7 ++++++- - mk_server/mk_user.c | 2 +- - 4 files changed, 25 insertions(+), 3 deletions(-) - -diff --git a/include/monkey/mk_http_parser.h b/include/monkey/mk_http_parser.h -index 9e3b365e..465ea0e4 100644 ---- a/include/monkey/mk_http_parser.h -+++ b/include/monkey/mk_http_parser.h -@@ -389,7 +389,11 @@ int mk_http_parser_chunked_decode_buf(struct mk_http_parser *p, - - static inline int mk_http_parser_more(struct mk_http_parser *p, int len) - { -- if (abs(len - p->i) - 1 > 0) { -+ if (len <= 0 || p->i < 0) { -+ return MK_FALSE; -+ } -+ -+ if ((p->i + 1) < len) { - return MK_TRUE; - } - -diff --git a/mk_server/mk_http_parser.c b/mk_server/mk_http_parser.c -index 9413528a..3c831f29 100644 ---- a/mk_server/mk_http_parser.c -+++ b/mk_server/mk_http_parser.c -@@ -173,6 +173,16 @@ static inline void request_set(mk_ptr_t *ptr, struct mk_http_parser *p, char *bu - static inline int header_cmp(const char *expected, char *value, int len) - { - int i = 0; -+ size_t expected_len; -+ -+ if (len < 0) { -+ return -1; -+ } -+ -+ expected_len = strlen(expected); -+ if ((size_t) len != expected_len) { -+ return -1; -+ } - - if (len >= 8) { - if (expected[0] != tolower(value[0])) return -1; -@@ -535,6 +545,9 @@ parse_more: - (errno != 0)) { - return MK_HTTP_PARSER_ERROR; - } -+ if (ptr == tmp || *ptr != '\0') { -+ return MK_HTTP_PARSER_ERROR; -+ } - - if (chunk_len < 0) { - return MK_HTTP_PARSER_ERROR; -diff --git a/mk_server/mk_mimetype.c b/mk_server/mk_mimetype.c -index b86b4ef1..5462ea5c 100644 ---- a/mk_server/mk_mimetype.c -+++ b/mk_server/mk_mimetype.c -@@ -197,7 +197,12 @@ struct mk_mimetype *mk_mimetype_find(struct mk_server *server, mk_ptr_t *filenam - { - int j, len; - -- j = len = filename->len; -+ if (!filename->data || filename->len <= 0) { -+ return NULL; -+ } -+ -+ len = filename->len; -+ j = len - 1; - - /* looking for extension */ - while (j >= 0 && filename->data[j] != '.') { -diff --git a/mk_server/mk_user.c b/mk_server/mk_user.c -index 7200ff08..716331ac 100644 ---- a/mk_server/mk_user.c -+++ b/mk_server/mk_user.c -@@ -46,7 +46,7 @@ int mk_user_init(struct mk_http_session *cs, struct mk_http_request *sr, - } - - limit = mk_string_char_search(sr->uri_processed.data + offset, '/', -- sr->uri_processed.len); -+ sr->uri_processed.len - offset); - - if (limit == -1) { - limit = (sr->uri_processed.len) - offset; diff --git a/meta-webserver/recipes-httpd/monkey/monkey_1.8.7.bb b/meta-webserver/recipes-httpd/monkey/monkey_1.8.10.bb similarity index 85% rename from meta-webserver/recipes-httpd/monkey/monkey_1.8.7.bb rename to meta-webserver/recipes-httpd/monkey/monkey_1.8.10.bb index a9bea8f767..8d624a618f 100644 --- a/meta-webserver/recipes-httpd/monkey/monkey_1.8.7.bb +++ b/meta-webserver/recipes-httpd/monkey/monkey_1.8.10.bb @@ -10,19 +10,19 @@ SECTION = "net" SRC_URI = "git://github.com/monkey/monkey;branch=master;protocol=https;tag=v${PV} \ file://0001-fastcgi-Use-value-instead-of-address-of-sin6_port.patch \ file://0001-include-Fix-location-of-mk_core.h-etal.patch \ + file://0001-build-Only-create-runtime-directories-inside-the-bui.patch \ file://monkey.service \ file://monkey.init \ - file://0001-server-http-fix-malformed-request-crash-paths.patch \ - file://0002-server-scheduler-guard-protocol-close-callback.patch \ - file://0003-server-parser-harden-boundary-checks.patch \ " -SRCREV = "0fd3bbd657c6d6339315709ef068493c572b973c" +SRCREV = "e257e6383585ac281ab7de2797fbc5eca64f804f" -UPSTREAM_CHECK_COMMITS = "1" +UPSTREAM_CHECK_GITTAGREGEX = "^v(?P\d+(\.\d+)+)$" EXTRA_OECMAKE = "-DMK_PATH_LOG=${localstatedir}/log/monkey/ \ -DPID_FILE=/run/monkey.pid \ + -DMK_PATH_PIDPATH=/run \ + -DMK_PATH_WWW=${datadir}/monkey/htdocs \ -DMK_PATH_CONF=${sysconfdir}/monkey/ \ -DWITH_PLUGINS=* \ -DWITHOUT_PLUGINS=mbedtls \ @@ -33,6 +33,9 @@ EXTRA_OECMAKE = "-DMK_PATH_LOG=${localstatedir}/log/monkey/ \ EXTRA_OECMAKE:append:libc-musl = " -DWITH_MUSL=1 " +PACKAGECONFIG ??= "" +PACKAGECONFIG[tls] = "-DMK_TLS=ON -DMK_TLS_BACKEND=openssl,-DMK_TLS=OFF,openssl" + DISABLE_STATIC = "" inherit cmake pkgconfig update-rc.d systemd @@ -43,6 +46,10 @@ do_configure:append() { do_install:append() { install -Dm 0755 ${UNPACKDIR}/monkey.init ${D}${sysconfdir}/init.d/monkey + # The build generates these but upstream has no install rule for them + for f in monkey.conf monkey.mime plugins.load sites/default; do + install -Dm 0644 ${B}/conf/$f ${D}${sysconfdir}/monkey/$f + done # Create /var/log/monkey in runtime. if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then install -d ${D}${nonarch_libdir}/tmpfiles.d @@ -58,7 +65,7 @@ do_install:append() { # QA Issue: monkey installs files in /var/volatile, but it is expected to be empty [empty-dirs] # these folders are supposed to be recreated at runtime - find ${D}/var -type d -empty -delete + find ${D}/var ${D}/run -type d -empty -delete } INITSCRIPT_NAME = "monkey"