[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-inetutils] [PATCH] inetd: Fix segfault when no arguments are provid
From: |
Guillem Jover |
Subject: |
[bug-inetutils] [PATCH] inetd: Fix segfault when no arguments are provided |
Date: |
Mon, 6 Sep 2010 11:18:40 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
* 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-inetutils] [PATCH] inetd: Fix segfault when no arguments are provided,
Guillem Jover <=