start-stop-daemon: Don't segfault if --exec was given a non-existing file name

Starting program: /sbin/start-stop-daemon --start --exec i-dont-exist

  Program received signal SIGSEGV, Segmentation fault.
  0x0000555555559053 in main (argc=1, argv=0x7fffffffdc20)
      at start-stop-daemon.c:631
  631                         *exec_file ? exec_file : exec);

This fixes #385.
This commit is contained in:
Lars Wendler 2020-11-18 11:08:47 +01:00 committed by William Hubbs
parent b6fef599bf
commit aa0fdf6d08

View File

@ -628,7 +628,7 @@ int main(int argc, char **argv)
} }
if (start && !exists(exec_file)) { if (start && !exists(exec_file)) {
eerror("%s: %s does not exist", applet, eerror("%s: %s does not exist", applet,
*exec_file ? exec_file : exec); exec_file ? exec_file : exec);
free(exec_file); free(exec_file);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }