Project

General

Profile

Actions

Bug #1021

closed

1.4.6: conf_filename not checked before use

Added by Mark Solaris over 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

If no -c argument is provided, no default conf file is used, or an error given.

(dbx) run u
Running: suricata -u
(process id 13852)
1/11/2013 -
07:28:58 - <Info> - This is Suricata version 1.4.6 RELEASE
1/11/2013 -- 07:28:58 - <Info> - CPUs/cores online: 64
t@1 (l@1) signal SEGV (no mapping at the fault address) in strlen at 0xffffffff7d93c750
0xffffffff7d93c750: strlen+0x0050: ld [%o2], %o1
Current function is main
1399 SCLogError(SC_ERR_LOGDIR_CONFIG, "The logging directory \"%s\" "
(dbx) list
1399 SCLogError(SC_ERR_LOGDIR_CONFIG, "The logging directory \"%s\" "
1400 "supplied by %s (default-log-dir) doesn't exist. "
1401 "Shutting down the engine", log_dir, conf_filename);
1402 exit(EXIT_FAILURE);
1403 }
1404 }
1405
1406 /* Pull the max pending packets from the config, if not found fall
1407 * back on a sane default. */
1408 if (ConfGetInt("max-pending-packets", &max_pending_packets) != 1)
(dbx) print log_dir
log_dir = 0x101e11ae8 "/var/log/suricata"
(dbx) print conf_filename
conf_filename = (nil)
Actions #1

Updated by Mark Solaris over 10 years ago

That's useful...

(dbx) run u -c /usr/local/suricata/conf/suricata.yaml
Running: suricata -u -c /usr/local/suricata/conf/suricata.yaml
(process id 13922)
1/11/2013 -
07:35:04 - <Info> - This is Suricata version 1.4.6 RELEASE
1/11/2013 -- 07:35:04 - <Info> - CPUs/cores online: 64
1/11/2013 -- 07:35:04 - <Error> - [ERRCODE: SC_ERR_CMD_LINE(195)] - should not use a configuration file with unittests
execution completed, exit code is 1
Actions #2

Updated by Mark Solaris over 10 years ago

--- ../suricata-1.4.6.orig/src/suricata.c Tue Sep 24 20:28:37 2013
++ src/suricata.c Fri Nov 1 07:46:46 2013
@ -1398,7 +1398,7 @
#endif /* OS_WIN32 */
SCLogError(SC_ERR_LOGDIR_CONFIG, "The logging directory \"%s\" "
"supplied by %s (default-log-dir) doesn't exist. "
- "Shutting down the engine", log_dir, conf_filename);
"Shutting down the engine", log_dir, conf_filename ? conf_filename : "(null)");
exit(EXIT_FAILURE);
}
}

Actions #3

Updated by Mark Solaris over 10 years ago

--- ../suricata-1.4.6.orig/src/suricata.c Tue Sep 24 20:28:37 2013
++ src/suricata.c Fri Nov 1 07:46:46 2013
@ -1398,7 +1398,7 @
#endif /* OS_WIN32 */
SCLogError(SC_ERR_LOGDIR_CONFIG, "The logging directory \"%s\" "
"supplied by %s (default-log-dir) doesn't exist. "
- "Shutting down the engine", log_dir, conf_filename);
"Shutting down the engine", log_dir, conf_filename ? conf_filename : "(null)");
exit(EXIT_FAILURE);
}
}

Actions #4

Updated by Mark Solaris over 10 years ago

--- ../suricata-1.4.6.orig/src/suricata.c Tue Sep 24 20:28:37 2013
+++ src/suricata.c Fri Nov 1 07:46:46 2013
@ -1398,7 +1398,7 @
#endif /* OS_WIN32 */
SCLogError(SC_ERR_LOGDIR_CONFIG, "The logging directory \"%s\" "
"supplied by %s (default-log-dir) doesn't exist. "
- "Shutting down the engine", log_dir, conf_filename);
+ "Shutting down the engine", log_dir, conf_filename ? conf_filename : "(null)");
exit(EXIT_FAILURE);
}
}

Actions #5

Updated by Victor Julien over 10 years ago

  • Target version set to 2.0rc1
Actions #6

Updated by Victor Julien over 10 years ago

  • Assignee set to OISF Dev
Actions #7

Updated by Victor Julien about 10 years ago

  • Target version changed from 2.0rc1 to 2.0rc2
Actions #8

Updated by Victor Julien about 10 years ago

  • Status changed from New to Closed

This is already fixed in the 2.0 branch. The check is now performed from PostConfLoadedSetup(), which is called after we made sure conf_filename is not NULL.

Actions

Also available in: Atom PDF