summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devel/Makefile1
-rw-r--r--devel/dfuzzer/Makefile39
-rw-r--r--devel/dfuzzer/distinfo3
-rw-r--r--devel/dfuzzer/files/patch-src_suppression.c53
-rw-r--r--devel/dfuzzer/pkg-descr5
5 files changed, 101 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index 1e79cdf8083a..6abb62f38833 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -611,6 +611,7 @@
SUBDIR += dev86
SUBDIR += devhelp
SUBDIR += devtodo
+ SUBDIR += dfuzzer
SUBDIR += dia2code
SUBDIR += dill
SUBDIR += ding-libs
diff --git a/devel/dfuzzer/Makefile b/devel/dfuzzer/Makefile
new file mode 100644
index 000000000000..0222cc8a391a
--- /dev/null
+++ b/devel/dfuzzer/Makefile
@@ -0,0 +1,39 @@
+PORTNAME= dfuzzer
+DISTVERSIONPREFIX= v
+DISTVERSION= 2.3
+CATEGORIES= devel sysutils
+
+MAINTAINER= arrowd@FreeBSD.org
+COMMENT= D-Bus fuzzer utility
+WWW= https://github.com/dbus-fuzzer/dfuzzer
+
+LICENSE= GPLv3
+LICENSE_FILE= ${WRKSRC}/COPYING
+
+USES= gnome meson pkgconfig
+
+USE_GNOME= glib20
+
+USE_GITHUB= yes
+GH_ACCOUNT= dbus-fuzzer
+
+PLIST_FILES= bin/dfuzzer \
+ "@sample etc/dfuzzer.conf.sample"
+
+OPTIONS_DEFINE= MANPAGES
+
+MANPAGES_BUILD_DEPENDS= xsltproc:textproc/libxslt \
+ docbook-xsl>=0:textproc/docbook-xsl
+MANPAGES_PLIST_FILES= share/man/man1/dfuzzer.1.gz
+
+post-patch:
+ ${REINPLACE_CMD} -e 's|/etc/dfuzzer.conf|${PREFIX}/etc/dfuzzer.conf|' \
+ ${WRKSRC}/man/dfuzzer.xml \
+ ${WRKSRC}/src/suppression.c
+ ${REINPLACE_CMD} -e 's|/stat|/status|g' ${WRKSRC}/test/test-util.c
+
+post-install:
+ ${MV} ${STAGEDIR}${PREFIX}/etc/dfuzzer.conf \
+ ${STAGEDIR}${PREFIX}/etc/dfuzzer.conf.sample
+
+.include <bsd.port.mk>
diff --git a/devel/dfuzzer/distinfo b/devel/dfuzzer/distinfo
new file mode 100644
index 000000000000..73d9e1528f68
--- /dev/null
+++ b/devel/dfuzzer/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1761920957
+SHA256 (dbus-fuzzer-dfuzzer-v2.3_GH0.tar.gz) = bd54bdd87c0d7c2818f6907130ef8c818ff454472503c74bd178fa39d2824cd6
+SIZE (dbus-fuzzer-dfuzzer-v2.3_GH0.tar.gz) = 53427
diff --git a/devel/dfuzzer/files/patch-src_suppression.c b/devel/dfuzzer/files/patch-src_suppression.c
new file mode 100644
index 000000000000..30b09ac56c2a
--- /dev/null
+++ b/devel/dfuzzer/files/patch-src_suppression.c
@@ -0,0 +1,53 @@
+From 4d9b7c01d68f64a93a25ff49504bbeca664adbc5 Mon Sep 17 00:00:00 2001
+From: Frantisek Sumsal <frantisek@sumsal.cz>
+Date: Wed, 29 Oct 2025 13:31:11 +0100
+Subject: [PATCH] suppression: avoid using sscanf()'s %m specifier
+
+As it's not available in BSD libc.
+
+Addresses: #153
+--- src/suppression.c.orig 2024-01-29 15:03:13 UTC
++++ src/suppression.c
+@@ -100,25 +100,31 @@ int df_suppression_load(GList **suppressions, const ch
+ df_verbose("Found suppressions for bus: '%s'\n", service_name);
+
+ while ((n = getline(&line, &len, f)) > 0) {
++ g_auto(GStrv) tokens = NULL;
+ g_autoptr(char) suppression = NULL, description = NULL;
+ g_autoptr(suppression_item_t) item = NULL;
++ int token_count;
+ char *p;
+
++ /* Strip leading and trailing whitespaces and check if the line is empty after the stripping -
++ * if so, skip it */
++ g_strstrip(line);
++ if (line[0] == '\0')
++ continue;
++
++ /* Beginning of the next section, stop here */
+ if (line[0] == '[')
+ break;
+
+- /* The line contains only whitespace, skip it */
+- if (strspn(line, " \t\r\n") == (size_t) n)
+- continue;
+-
+- /* Drop the newline character for nices error messages */
+- if (line[n - 1] == '\n')
+- line[n - 1] = 0;
+-
+- /* The suppression description is optional, so let's accept such
+- * lines as well */
+- if (sscanf(line, "%ms %m[^\n]", &suppression, &description) < 1)
++ /* Split the line into either '<suppression> <description>' or just '<suppression>' */
++ tokens = g_strsplit_set(line, " \t\r\n", 2);
++ token_count = g_strv_length(tokens);
++ if (token_count < 1)
+ return df_fail_ret(-1, "Failed to parse line '%s'\n", line);
++
++ suppression = g_strdup(tokens[0]);
++ if (token_count > 1)
++ description = g_strdup(g_strstrip(tokens[1]));
+
+ item = calloc(sizeof(*item), 1);
+ if (!item)
diff --git a/devel/dfuzzer/pkg-descr b/devel/dfuzzer/pkg-descr
new file mode 100644
index 000000000000..3e3a888d929c
--- /dev/null
+++ b/devel/dfuzzer/pkg-descr
@@ -0,0 +1,5 @@
+dfuzzer is a tool for fuzz testing processes communicating through D-Bus.
+It can be used to test processes connected to both the session bus and the
+system bus. The fuzzer works as a client, first connecting to a bus and then
+traversing and fuzzing all the methods and properties provided by a D-Bus
+service.