opensmtpd: fix missing braces in proc_path.diff for fork_filter_process

The else branch in fork_filter_process was missing braces, causing
proc_path to be read uninitialised and passing garbage to sh -c,
crashing smtpd with a syntax error.
This commit is contained in:
phaer
2026-04-08 20:40:33 +02:00
parent 0c682de245
commit dd0017c90e
+11 -6
View File
@@ -32,17 +32,22 @@ index 2365b1ee..b1b6bcec 100644
char exec[_POSIX_ARG_MAX];
int execr;
@@ -1455,8 +1462,12 @@ fork_filter_process(const char *name, const char *command, const char *user, con
if (command[0] == '/')
execr = snprintf(exec, sizeof(exec), "exec %s", command);
else
@@ -1455,7 +1462,12 @@ fork_filter_process(const char *name, const char *command, const char *user, con
- if (command[0] == '/')
- execr = snprintf(exec, sizeof(exec), "exec %s", command);
- else
- execr = snprintf(exec, sizeof(exec), "exec %s/%s",
- PATH_LIBEXEC, command);
+ if (command[0] == '/') {
+ execr = snprintf(exec, sizeof(exec), "exec %s", command);
+ } else {
+ proc_path = getenv("OPENSMTPD_PROC_PATH");
+ if (proc_path == NULL) {
+ proc_path = PATH_LIBEXEC;
+ }
execr = snprintf(exec, sizeof(exec), "exec %s/%s",
- PATH_LIBEXEC, command);
+ execr = snprintf(exec, sizeof(exec), "exec %s/%s",
+ proc_path, command);
+ }
if (execr >= (int) sizeof(exec))
fatalx("%s: exec path too long", name);