]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: also set iov_len when deserializing LogExtraFields=
authorLuca Boccassi <luca.boccassi@gmail.com>
Mon, 23 Mar 2026 00:25:46 +0000 (00:25 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 23 Mar 2026 00:54:23 +0000 (00:54 +0000)
This is not actually used so it doesn't really matter in
practice and the fields are used anyway, but for cleanliness
fix it

Reported on yeswehack.com as YWH-PGM9780-165

Follow-up for 5699a1689b7e49702e4e60d08ab3fe386ba8d4df

src/core/execute-serialize.c

index 8f9a7ac5464028840abacbe0ea3c8e3e0e33ed2d..c8f802687ee5bfc2da750154433d865f6aaba6f5 100644 (file)
@@ -3113,9 +3113,11 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) {
                         if (!GREEDY_REALLOC(c->log_extra_fields, c->n_log_extra_fields + 1))
                                 return log_oom_debug();
 
-                        c->log_extra_fields[c->n_log_extra_fields++].iov_base = strdup(val);
-                        if (!c->log_extra_fields[c->n_log_extra_fields-1].iov_base)
+                        char *field = strdup(val);
+                        if (!field)
                                 return log_oom_debug();
+
+                        c->log_extra_fields[c->n_log_extra_fields++] = IOVEC_MAKE_STRING(field);
                 } else if ((val = startswith(l, "exec-context-log-namespace="))) {
                         r = free_and_strdup(&c->log_namespace, val);
                         if (r < 0)