Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
From 7a8f42fb20013a1493d8cae1c43436f85e656f2d Mon Sep 17 00:00:00 2001
|
||||
From: Zephkeks <zephyrofficialdiscord@gmail.com>
|
||||
Date: Tue, 13 May 2025 11:04:17 +0200
|
||||
Subject: [PATCH] CVE-2025-46836: interface.c: Stack-based Buffer Overflow in
|
||||
get_name()
|
||||
|
||||
Coordinated as GHSA-pfwf-h6m3-63wf
|
||||
|
||||
Upstream: https://github.com/ecki/net-tools/commit/7a8f42fb20013a1493d8cae1c43436f85e656f2d
|
||||
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
||||
---
|
||||
lib/interface.c | 63 ++++++++++++++++++++++++++++++-------------------
|
||||
1 file changed, 39 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/lib/interface.c b/lib/interface.c
|
||||
index 71d4163..a054f12 100644
|
||||
--- a/lib/interface.c
|
||||
+++ b/lib/interface.c
|
||||
@@ -211,32 +211,47 @@ out:
|
||||
}
|
||||
|
||||
static const char *get_name(char *name, const char *p)
|
||||
+/* Safe version — guarantees at most IFNAMSIZ‑1 bytes are copied
|
||||
+ and the destination buffer is always NUL‑terminated. */
|
||||
{
|
||||
- while (isspace(*p))
|
||||
- p++;
|
||||
- while (*p) {
|
||||
- if (isspace(*p))
|
||||
- break;
|
||||
- if (*p == ':') { /* could be an alias */
|
||||
- const char *dot = p++;
|
||||
- while (*p && isdigit(*p)) p++;
|
||||
- if (*p == ':') {
|
||||
- /* Yes it is, backup and copy it. */
|
||||
- p = dot;
|
||||
- *name++ = *p++;
|
||||
- while (*p && isdigit(*p)) {
|
||||
- *name++ = *p++;
|
||||
- }
|
||||
- } else {
|
||||
- /* No, it isn't */
|
||||
- p = dot;
|
||||
- }
|
||||
- p++;
|
||||
- break;
|
||||
- }
|
||||
- *name++ = *p++;
|
||||
+ char *dst = name; /* current write ptr */
|
||||
+ const char *end = name + IFNAMSIZ - 1; /* last byte we may write */
|
||||
+
|
||||
+ /* Skip leading white‑space. */
|
||||
+ while (isspace((unsigned char)*p))
|
||||
+ ++p;
|
||||
+
|
||||
+ /* Copy until white‑space, end of string, or buffer full. */
|
||||
+ while (*p && !isspace((unsigned char)*p) && dst < end) {
|
||||
+ if (*p == ':') { /* possible alias veth0:123: */
|
||||
+ const char *dot = p; /* remember the colon */
|
||||
+ ++p;
|
||||
+ while (*p && isdigit((unsigned char)*p))
|
||||
+ ++p;
|
||||
+
|
||||
+ if (*p == ':') { /* confirmed alias */
|
||||
+ p = dot; /* rewind and copy it all */
|
||||
+
|
||||
+ /* copy the colon */
|
||||
+ if (dst < end)
|
||||
+ *dst++ = *p++;
|
||||
+
|
||||
+ /* copy the digits */
|
||||
+ while (*p && isdigit((unsigned char)*p) && dst < end)
|
||||
+ *dst++ = *p++;
|
||||
+
|
||||
+ if (*p == ':') /* consume trailing colon */
|
||||
+ ++p;
|
||||
+ } else { /* if so treat as normal */
|
||||
+ p = dot;
|
||||
+ }
|
||||
+ break; /* interface name ends here */
|
||||
+ }
|
||||
+
|
||||
+ *dst++ = *p++; /* ordinary character copy */
|
||||
}
|
||||
- *name++ = '\0';
|
||||
+
|
||||
+ *dst = '\0'; /* always NUL‑terminate */
|
||||
return p;
|
||||
}
|
||||
|
||||
--
|
||||
2.39.5
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From ddb0e375fb9ca95bb69335540b85bbdaa2714348 Mon Sep 17 00:00:00 2001
|
||||
From: Bernd Eckenfels <net-tools@lina.inka.de>
|
||||
Date: Sat, 17 May 2025 21:53:23 +0200
|
||||
Subject: [PATCH] Interface statistic regression after 7a8f42fb2
|
||||
|
||||
CVE: CVE-2025-46836
|
||||
Upstream: https://sourceforge.net/p/net-tools/code/ci/ddb0e375fb9ca95bb69335540b85bbdaa2714348/
|
||||
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
|
||||
---
|
||||
lib/interface.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/interface.c b/lib/interface.c
|
||||
index a054f12..ca4adf1 100644
|
||||
--- a/lib/interface.c
|
||||
+++ b/lib/interface.c
|
||||
@@ -239,12 +239,11 @@ static const char *get_name(char *name, const char *p)
|
||||
/* copy the digits */
|
||||
while (*p && isdigit((unsigned char)*p) && dst < end)
|
||||
*dst++ = *p++;
|
||||
-
|
||||
- if (*p == ':') /* consume trailing colon */
|
||||
- ++p;
|
||||
} else { /* if so treat as normal */
|
||||
p = dot;
|
||||
}
|
||||
+ if (*p == ':') /* consume trailing colon */
|
||||
+ ++p;
|
||||
break; /* interface name ends here */
|
||||
}
|
||||
10
package/net-tools/Config.in
Normal file
10
package/net-tools/Config.in
Normal file
@@ -0,0 +1,10 @@
|
||||
config BR2_PACKAGE_NET_TOOLS
|
||||
bool "net-tools"
|
||||
depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
|
||||
help
|
||||
A collection of programs that form the base set of the NET-3
|
||||
networking distribution for the Linux operating system.
|
||||
Includes: arp, hostname, ifconfig, netstat, rarp, route,
|
||||
plipconfig, slattach, mii-tool, iptunnel and ipmaddr.
|
||||
|
||||
http://sourceforge.net/projects/net-tools/
|
||||
6
package/net-tools/net-tools.hash
Normal file
6
package/net-tools/net-tools.hash
Normal file
@@ -0,0 +1,6 @@
|
||||
# From http://sourceforge.net/projects/net-tools/files/
|
||||
sha1 4080baab0486dc882c3b293d5559c27251ae4268 net-tools-2.10.tar.xz
|
||||
md5 78aae762c95e2d731faf88d482e4cde5 net-tools-2.10.tar.xz
|
||||
# Locally computed
|
||||
sha256 b262435a5241e89bfa51c3cabd5133753952f7a7b7b93f32e08cb9d96f580d69 net-tools-2.10.tar.xz
|
||||
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
|
||||
67
package/net-tools/net-tools.mk
Normal file
67
package/net-tools/net-tools.mk
Normal file
@@ -0,0 +1,67 @@
|
||||
################################################################################
|
||||
#
|
||||
# net-tools
|
||||
#
|
||||
################################################################################
|
||||
|
||||
NET_TOOLS_VERSION = 2.10
|
||||
NET_TOOLS_SOURCE = net-tools-$(NET_TOOLS_VERSION).tar.xz
|
||||
NET_TOOLS_SITE = http://downloads.sourceforge.net/project/net-tools
|
||||
NET_TOOLS_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)
|
||||
NET_TOOLS_LICENSE = GPL-2.0+
|
||||
NET_TOOLS_LICENSE_FILES = COPYING
|
||||
NET_TOOLS_CPE_ID_VALID = YES
|
||||
|
||||
# 0001-CVE-2025-46836-interface.c-Stack-based-Buffer-Overfl.patch
|
||||
# 0002-CVE-2025-46836-interface-statistic-regression.patch
|
||||
NET_TOOLS_IGNORE_CVES += CVE-2025-46836
|
||||
|
||||
define NET_TOOLS_CONFIGURE_CMDS
|
||||
(cd $(@D); yes "" | ./configure.sh config.in )
|
||||
endef
|
||||
|
||||
# Enable I18N when appropriate
|
||||
ifeq ($(BR2_SYSTEM_ENABLE_NLS),y)
|
||||
define NET_TOOLS_ENABLE_I18N
|
||||
$(SED) 's:I18N 0:I18N 1:' $(@D)/config.h
|
||||
endef
|
||||
endif
|
||||
|
||||
# Enable IPv6
|
||||
define NET_TOOLS_ENABLE_IPV6
|
||||
$(SED) 's:_AFINET6 0:_AFINET6 1:' $(@D)/config.h
|
||||
endef
|
||||
|
||||
ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_7_1),y)
|
||||
define NET_TOOLS_DISABLE_ROSE
|
||||
$(SED) 's:HAVE_AFROSE 1:HAVE_AFROSE 0:' \
|
||||
-e 's:HAVE_HWROSE 1:HAVE_HWROSE 0:' $(@D)/config.h
|
||||
endef
|
||||
endif
|
||||
|
||||
NET_TOOLS_POST_CONFIGURE_HOOKS += \
|
||||
NET_TOOLS_DISABLE_ROSE \
|
||||
NET_TOOLS_ENABLE_I18N \
|
||||
NET_TOOLS_ENABLE_IPV6
|
||||
|
||||
define NET_TOOLS_BUILD_CMDS
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)" \
|
||||
$(MAKE) -C $(@D)
|
||||
endef
|
||||
|
||||
# ifconfig & route reside in /sbin for busybox, so ensure we don't end
|
||||
# up with two versions of those.
|
||||
ifeq ($(BR2_ROOTFS_MERGED_BIN),)
|
||||
define NET_TOOLS_INSTALL_MV_BINS
|
||||
mv -f $(TARGET_DIR)/bin/ifconfig $(TARGET_DIR)/sbin/ifconfig
|
||||
mv -f $(TARGET_DIR)/bin/route $(TARGET_DIR)/sbin/route
|
||||
endef
|
||||
endif
|
||||
|
||||
define NET_TOOLS_INSTALL_TARGET_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
|
||||
$(NET_TOOLS_INSTALL_MV_BINS)
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user