]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Fix journald audit logging with fields > N_IOVEC_AUDIT_FIELDS.
authorYmrDtnJu <YmrDtnJu@users.noreply.github.com>
Fri, 21 Jan 2022 17:21:27 +0000 (18:21 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 21 Jan 2022 23:12:45 +0000 (23:12 +0000)
ELEMENTSOF(iovec) is not the correct value for the newly introduced parameter m
to function map_all_fields because it is the maximum number of elements in the
iovec array, including those reserved for N_IOVEC_META_FIELDS. The correct
value is the current number of already used elements in the array plus the
maximum number to use for fields decoded from the kernel audit message.

src/journal/journald-audit.c

index a8e3b175ac4906e00bfc470abf1f1b29c2bfc36b..ea535a27af7fef0cdbdd79b4aaee0b1a9dda43bd 100644 (file)
@@ -399,7 +399,7 @@ void process_audit_string(Server *s, int type, const char *data, size_t size) {
 
         z = n;
 
-        map_all_fields(p, map_fields_kernel, "_AUDIT_FIELD_", true, iovec, &n, ELEMENTSOF(iovec));
+        map_all_fields(p, map_fields_kernel, "_AUDIT_FIELD_", true, iovec, &n, n + N_IOVEC_AUDIT_FIELDS);
 
         server_dispatch_message(s, iovec, n, ELEMENTSOF(iovec), NULL, NULL, LOG_NOTICE, 0);