summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2001-02-18 04:02:26 +0000
committerBill Nottingham <notting@redhat.com>2001-02-18 04:02:26 +0000
commit52f24a525230917621e94c80bfa48a6a4db74dfe (patch)
tree217c38cb885c6532c31cc5011e0be0eafc798b0a
parentb6cc3a944e5c8a57e11032c66527a0f41f133144 (diff)
downloadinitscripts-52f24a525230917621e94c80bfa48a6a4db74dfe.tar.gz
initscripts-52f24a525230917621e94c80bfa48a6a4db74dfe.tar.xz
initscripts-52f24a525230917621e94c80bfa48a6a4db74dfe.zip
fix segfaults in popt when called with bogus stuff (#28140)
-rw-r--r--src/initlog.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/initlog.c b/src/initlog.c
index 32863591..c102f082 100644
--- a/src/initlog.c
+++ b/src/initlog.c
@@ -1,4 +1,5 @@
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <libintl.h>
@@ -416,13 +417,16 @@ int processArgs(int argc, char **argv, int silent) {
} else {
readConfiguration("/etc/initlog.conf");
}
+ if (cmd) {
+ while (isspace(*cmd)) cmd++;
+ }
if (lpri!=-1) logpriority=lpri;
if (lfac!=-1) logfacility=lfac;
if (cmdevent) {
logEvent(cmdname,cmdevent,logstring);
} else if (logstring) {
logString(cmdname,logstring);
- } else if ( cmd ) {
+ } else if ( cmd && *cmd) {
return(runCommand(cmd,reexec,quiet,debug));
} else {
if (!silent)