Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
From 3afcd237e509a6700c449056dcc5b9092af31e6a Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Mon, 6 Nov 2023 21:38:02 +0100
|
||||
Subject: [PATCH] resources/Makefile.in-lua: fix build with Lua 5.1
|
||||
|
||||
Fix the following build failure with Lua 5.1 raised since version 1.16
|
||||
and
|
||||
https://github.com/civetweb/civetweb/commit/82ba5a04c9a1ca980d8dfe00c18e086017e8ab25:
|
||||
|
||||
/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sh4-buildroot-linux-gnu/13.2.0/../../../../sh4-buildroot-linux-gnu/bin/ld: out/src/third_party/lua_struct.o: in function `luaopen_struct':
|
||||
lua_struct.c:(.text+0xce4): undefined reference to `luaL_newlib'
|
||||
|
||||
Fixes:
|
||||
- http://autobuild.buildroot.org/results/7459b504e52f473c5830c0f3c7bffd037f6e1770
|
||||
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Upstream: https://github.com/civetweb/civetweb/pull/1211
|
||||
---
|
||||
resources/Makefile.in-lua | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/resources/Makefile.in-lua b/resources/Makefile.in-lua
|
||||
index d3038f66..45f80181 100644
|
||||
--- a/resources/Makefile.in-lua
|
||||
+++ b/resources/Makefile.in-lua
|
||||
@@ -150,6 +150,7 @@ CFLAGS += -DUSE_LUA_FILE_SYSTEM
|
||||
#SOURCE_DIRS = $(LFS_DIR)
|
||||
|
||||
|
||||
+ifneq ($(WITH_LUA_VERSION), 501)
|
||||
LXX_DIR = src/third_party
|
||||
LXX_SOURCE_FILES = lua_struct.c
|
||||
LXX_SOURCES = $(addprefix $(LXX_DIR)/, $(LXX_SOURCE_FILES))
|
||||
@@ -159,6 +160,7 @@ OBJECTS += $(LXX_OBJECTS)
|
||||
CFLAGS += $(LXX_CFLAGS)
|
||||
CFLAGS += -DUSE_LUA_STRUCT
|
||||
#SOURCE_DIRS = $(LXX_DIR)
|
||||
+endif
|
||||
|
||||
|
||||
ifneq ($(WITH_LUA_VERSION), 501)
|
||||
--
|
||||
2.42.0
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
From 76e222bcb77ba8452e5da4e82ae6cecd499c25e0 Mon Sep 17 00:00:00 2001
|
||||
From: krispybyte <krispybyte@proton.me>
|
||||
Date: Sat, 21 Jun 2025 23:33:50 +0300
|
||||
Subject: [PATCH] Fix heap overflow in directory URI slash redirection
|
||||
|
||||
CVE: CVE-2025-55763
|
||||
Upstream: https://github.com/civetweb/civetweb/commit/76e222bcb77ba8452e5da4e82ae6cecd499c25e0
|
||||
[thomas: fix offset]
|
||||
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
|
||||
---
|
||||
src/civetweb.c | 23 ++++++++++++++++++-----
|
||||
1 file changed, 18 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/civetweb.c b/src/civetweb.c
|
||||
index bbc9aa8be..e969c939f 100644
|
||||
--- a/src/civetweb.c
|
||||
+++ b/src/civetweb.c
|
||||
@@ -15242,7 +15242,6 @@ handle_request(struct mg_connection *conn)
|
||||
/* 12. Directory uris should end with a slash */
|
||||
if (file.stat.is_directory && ((uri_len = (int)strlen(ri->local_uri)) > 0)
|
||||
&& (ri->local_uri[uri_len - 1] != '/')) {
|
||||
-
|
||||
/* Path + server root */
|
||||
size_t buflen = UTF8_PATH_MAX * 2 + 2;
|
||||
char *new_path;
|
||||
@@ -15254,12 +15254,26 @@ handle_request(struct mg_connection *conn)
|
||||
mg_send_http_error(conn, 500, "out or memory");
|
||||
} else {
|
||||
mg_get_request_link(conn, new_path, buflen - 1);
|
||||
- strcat(new_path, "/");
|
||||
+
|
||||
+ size_t len = strlen(new_path);
|
||||
+ if (len + 1 < buflen) {
|
||||
+ new_path[len] = '/';
|
||||
+ new_path[len + 1] = '\0';
|
||||
+ len += 1;
|
||||
+ }
|
||||
+
|
||||
if (ri->query_string) {
|
||||
- /* Append ? and query string */
|
||||
- strcat(new_path, "?");
|
||||
- strcat(new_path, ri->query_string);
|
||||
+ if (len + 1 < buflen) {
|
||||
+ new_path[len] = '?';
|
||||
+ new_path[len + 1] = '\0';
|
||||
+ len += 1;
|
||||
+ }
|
||||
+
|
||||
+ /* Append with size of space left for query string + null terminator */
|
||||
+ size_t max_append = buflen - len - 1;
|
||||
+ strncat(new_path, ri->query_string, max_append);
|
||||
}
|
||||
+
|
||||
mg_send_http_redirect(conn, new_path, 301);
|
||||
mg_free(new_path);
|
||||
}
|
||||
28
package/civetweb/Config.in
Normal file
28
package/civetweb/Config.in
Normal file
@@ -0,0 +1,28 @@
|
||||
config BR2_PACKAGE_CIVETWEB
|
||||
bool "civetweb"
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
depends on BR2_USE_MMU # fork()
|
||||
select BR2_PACKAGE_CIVETWEB_SERVER if !BR2_PACKAGE_CIVETWEB_LIB
|
||||
help
|
||||
Full featured embedded web server with Lua support.
|
||||
|
||||
https://sourceforge.net/projects/civetweb
|
||||
|
||||
if BR2_PACKAGE_CIVETWEB
|
||||
|
||||
config BR2_PACKAGE_CIVETWEB_SERVER
|
||||
bool "enable the web server application"
|
||||
help
|
||||
Include the web server and its config files.
|
||||
|
||||
config BR2_PACKAGE_CIVETWEB_LIB
|
||||
bool "enable library for embedding"
|
||||
help
|
||||
Enable the civetweb library for embedding in another
|
||||
application.
|
||||
|
||||
endif
|
||||
|
||||
comment "civetweb needs a toolchain w/ threads"
|
||||
depends on BR2_USE_MMU
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS
|
||||
3
package/civetweb/civetweb.hash
Normal file
3
package/civetweb/civetweb.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# Locally calculated
|
||||
sha256 f0e471c1bf4e7804a6cfb41ea9d13e7d623b2bcc7bc1e2a4dd54951a24d60285 civetweb-1.16.tar.gz
|
||||
sha256 bc24af9ffb777f4842f8556ac752efd5ea212c55d2eccfae58cc2c2a24ea1f03 LICENSE.md
|
||||
108
package/civetweb/civetweb.mk
Normal file
108
package/civetweb/civetweb.mk
Normal file
@@ -0,0 +1,108 @@
|
||||
################################################################################
|
||||
#
|
||||
# civetweb
|
||||
#
|
||||
################################################################################
|
||||
|
||||
CIVETWEB_VERSION = 1.16
|
||||
CIVETWEB_SITE = $(call github,civetweb,civetweb,v$(CIVETWEB_VERSION))
|
||||
CIVETWEB_LICENSE = MIT
|
||||
CIVETWEB_LICENSE_FILES = LICENSE.md
|
||||
CIVETWEB_CPE_ID_VALID = YES
|
||||
|
||||
# 0002-Fix-heap-overflow-in-directory-URI-slash-redirection.patch
|
||||
CIVETWEB_IGNORE_CVES += CVE-2025-55763
|
||||
|
||||
CIVETWEB_CONF_OPTS = TARGET_OS=LINUX WITH_IPV6=1 \
|
||||
$(if $(BR2_INSTALL_LIBSTDCPP),WITH_CPP=1)
|
||||
CIVETWEB_COPT = -DHAVE_POSIX_FALLOCATE=0
|
||||
CIVETWEB_LIBS = -lpthread -lm
|
||||
CIVETWEB_SYSCONFDIR = /etc
|
||||
CIVETWEB_HTMLDIR = /var/www
|
||||
CIVETWEB_INSTALL_OPTS = \
|
||||
DOCUMENT_ROOT="$(CIVETWEB_HTMLDIR)" \
|
||||
CONFIG_FILE2="$(CIVETWEB_SYSCONFDIR)/civetweb.conf" \
|
||||
HTMLDIR="$(TARGET_DIR)$(CIVETWEB_HTMLDIR)" \
|
||||
SYSCONFDIR="$(TARGET_DIR)$(CIVETWEB_SYSCONFDIR)"
|
||||
|
||||
ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4),)
|
||||
CIVETWEB_COPT += -DNO_ATOMICS=1
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LUAJIT),y)
|
||||
CIVETWEB_CONF_OPTS += WITH_LUAJIT_SHARED=1
|
||||
CIVETWEB_LIBS += `$(PKG_CONFIG_HOST_BINARY) --libs luajit` -ldl
|
||||
CIVETWEB_DEPENDENCIES += host-pkgconf luajit
|
||||
else ifeq ($(BR2_PACKAGE_LUA):$(BR2_STATIC_LIBS),y:)
|
||||
CIVETWEB_CONF_OPTS += WITH_LUA=1 WITH_LUA_SHARED=1 LUA_SHARED_LIB_FLAG=''
|
||||
CIVETWEB_LIBS += `$(PKG_CONFIG_HOST_BINARY) --libs lua`
|
||||
CIVETWEB_DEPENDENCIES += host-pkgconf lua
|
||||
ifeq ($(BR2_PACKAGE_LUA_5_1),y)
|
||||
CIVETWEB_CONF_OPTS += WITH_LUA_VERSION=501
|
||||
else ifeq ($(BR2_PACKAGE_LUA_5_3),y)
|
||||
CIVETWEB_CONF_OPTS += WITH_LUA_VERSION=503
|
||||
else ifeq ($(BR2_PACKAGE_LUA_5_4),y)
|
||||
CIVETWEB_CONF_OPTS += WITH_LUA_VERSION=504
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_OPENSSL),y)
|
||||
CIVETWEB_COPT += -DNO_SSL_DL
|
||||
CIVETWEB_LIBS += `$(PKG_CONFIG_HOST_BINARY) --libs openssl`
|
||||
CIVETWEB_DEPENDENCIES += openssl host-pkgconf
|
||||
else
|
||||
CIVETWEB_COPT += -DNO_SSL
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_ZLIB),y)
|
||||
CIVETWEB_CONF_OPTS += WITH_ZLIB=1
|
||||
CIVETWEB_LIBS += -lz
|
||||
CIVETWEB_DEPENDENCIES += zlib
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_CIVETWEB_SERVER),y)
|
||||
CIVETWEB_BUILD_TARGETS += build
|
||||
CIVETWEB_INSTALL_TARGETS += install
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_CIVETWEB_LIB),y)
|
||||
CIVETWEB_INSTALL_STAGING = YES
|
||||
CIVETWEB_INSTALL_TARGETS += install-headers
|
||||
|
||||
ifeq ($(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
|
||||
CIVETWEB_BUILD_TARGETS += lib
|
||||
CIVETWEB_INSTALL_TARGETS += install-lib
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
|
||||
CIVETWEB_BUILD_TARGETS += slib
|
||||
CIVETWEB_INSTALL_TARGETS += install-slib
|
||||
endif
|
||||
|
||||
endif # BR2_PACKAGE_CIVETWEB_LIB
|
||||
|
||||
define CIVETWEB_BUILD_CMDS
|
||||
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) $(CIVETWEB_BUILD_TARGETS) \
|
||||
$(CIVETWEB_CONF_OPTS) \
|
||||
COPT="$(CIVETWEB_COPT)" LIBS="$(CIVETWEB_LIBS)"
|
||||
endef
|
||||
|
||||
define CIVETWEB_INSTALL_STAGING_CMDS
|
||||
mkdir -p $(STAGING_DIR)/usr/include
|
||||
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) $(CIVETWEB_INSTALL_TARGETS) \
|
||||
PREFIX="$(STAGING_DIR)/usr" \
|
||||
$(CIVETWEB_INSTALL_OPTS) \
|
||||
$(CIVETWEB_CONF_OPTS) \
|
||||
COPT='$(CIVETWEB_COPT)'
|
||||
endef
|
||||
|
||||
define CIVETWEB_INSTALL_TARGET_CMDS
|
||||
mkdir -p $(TARGET_DIR)/usr/include
|
||||
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) $(CIVETWEB_INSTALL_TARGETS) \
|
||||
PREFIX="$(TARGET_DIR)/usr" \
|
||||
$(CIVETWEB_INSTALL_OPTS) \
|
||||
$(CIVETWEB_CONF_OPTS) \
|
||||
COPT='$(CIVETWEB_COPT)'
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user