summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2010-09-08 04:24:45 +0200
committerGuillem Jover <guillem@hadrons.org>2010-09-12 16:29:04 +0200
commit8ac71e4137660c38d63c71b335c95b096f7b0756 (patch)
tree6075e80bab76cecf2857af6f5ff8c3b99b28f373
parent326aed70e6ecbf02a49395ceb29d2a255431b795 (diff)
downloadinetutils-8ac71e4137660c38d63c71b335c95b096f7b0756.tar.gz
Do not segfault in inetd when a service does not have any argument
Closes: #515070, #590128
-rw-r--r--debian/changelog2
-rw-r--r--debian/patches/60_inetd_support_argless_services.patch40
-rw-r--r--debian/patches/series1
3 files changed, 43 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index bb9d8d5..0011f72 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,8 @@ inetutils (2:1.8-1) UNRELEASED; urgency=low
referencing generic and non-matching file from common-licenses.
* Now using Standards-Version 3.9.1.
* Remove obsolete and unused libopie-dev Build-Depends.
+ * Do not segfault in inetd when a service does not have any argument.
+ (Closes: #515070, #590128)
-- Guillem Jover <guillem@debian.org> Tue, 08 Jun 2010 21:16:04 +0200
diff --git a/debian/patches/60_inetd_support_argless_services.patch b/debian/patches/60_inetd_support_argless_services.patch
new file mode 100644
index 0000000..e5280f1
--- /dev/null
+++ b/debian/patches/60_inetd_support_argless_services.patch
@@ -0,0 +1,40 @@
+From 93e33a312d840eed7a85faa1d5a56b2cd6846001 Mon Sep 17 00:00:00 2001
+From: Guillem Jover <guillem@hadrons.org>
+Date: Mon, 6 Sep 2010 08:52:59 +0200
+Subject: [PATCH] inetd: Inject server name in argv[0] when no arguments are provided
+
+* src/inetd.c (getconfigent): If se_argc == 1 inject the normalized
+se_server name into se_argv[0].
+---
+ src/inetd.c | 15 +++++++++++++++
+ 1 files changed, 15 insertions(+), 0 deletions(-)
+
+diff --git a/src/inetd.c b/src/inetd.c
+index 6fe9adf..354ae1d 100644
+--- a/src/inetd.c
++++ b/src/inetd.c
+@@ -1108,6 +1108,21 @@ getconfigent (FILE *fconfig, const char *file, size_t *line)
+ sep->se_argv[i] = argv[INETD_SERVER_ARGS + i];
+ argv[INETD_SERVER_ARGS + i] = 0;
+ }
++
++ /* If no arguments are provided, use server name as argv[0]. */
++ if (sep->se_argc == 1)
++ {
++ const char *argv0 = NULL;
++
++ argv0 = strrchr (sep->se_server, '/');
++ if (argv0)
++ argv0++;
++ else
++ argv0 = sep->se_server;
++
++ sep->se_argv[0] = newstr (argv0);
++ }
++
+ sep->se_argv[i] = NULL;
+ break;
+ }
+--
+1.7.1
+
diff --git a/debian/patches/series b/debian/patches/series
index 14ce6a7..9ea855d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@
51_add_load_confdir_support.patch
53_man_inetd_max_conn.patch
54_man_fixes.patch
+60_inetd_support_argless_services.patch