Safer handling of argument-logging memory of cwd
[exim.git] / src / src / exim.c
index d740814f9eab856080b3cfa9adce9e4c4d6ba1cd..810550dd509657acb04b5afef14837569ad09f87 100644 (file)
@@ -4091,8 +4091,11 @@ if (((debug_selector & D_any) != 0 || LOGGING(arguments))
   Ustrcpy(p, "cwd= (failed)");
 
   Ustrncpy(p + 4, initial_cwd, big_buffer_size-5);
+  p += 4 + Ustrlen(initial_cwd);
+  /* in case p is near the end and we don't provide enough space for
+   * string_format to be willing to write. */
+  *p = '\0';
 
-  while (*p) p++;
   (void)string_format(p, big_buffer_size - (p - big_buffer), " %d args:", argc);
   while (*p) p++;
   for (i = 0; i < argc; i++)
@@ -5152,6 +5155,8 @@ if (recipients_arg >= argc && !extract_recipients && !smtp_input)
   {
   if (version_printed)
     {
+    if (Ustrchr(config_main_filelist, ':'))
+      printf("Configuration file search path is %s\n", config_main_filelist);
     printf("Configuration file is %s\n", config_main_filename);
     return EXIT_SUCCESS;
     }