]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
util: script - Fix handling environment variables if they contain \001 characters
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 2 Mar 2026 12:07:59 +0000 (14:07 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 4 Mar 2026 07:58:44 +0000 (07:58 +0000)
This could have resulted in a crash or at least wrong behavior.

Broken since the environment code was added in
7e993ece468916599df2feb3d4c64a91c69cedf8

src/util/script.c

index 391b87bc0620cbea20fadeebdba9e9b7ecda0ecd..bc5eeb50deb6459a9d4bec711e30eab957780e89 100644 (file)
@@ -165,7 +165,7 @@ parse_input(ARRAY_TYPE(const_string)* envs, const char *const **args_r,
                        p = strchr(env, '=');
                        if (p == NULL)
                                i_fatal("invalid environment variable");
-                       envname = t_strdup_until((**args_r)+4, p);
+                       envname = t_strdup_until(env, p);
 
                        if (str_array_find(accepted_envs, envname))
                                array_push_back(envs, &env);