Skip to content

Commit 3ea61d3

Browse files
committed
af_unix plugin: Restore terminating newlines
1 parent ace13f3 commit 3ea61d3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

audisp/plugins/af_unix/audisp-af_unix.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,17 @@ static int event_to_string(struct audit_dispatcher_header *hdr,
207207
"UNKNOWN[%u]", hdr->type);
208208
type = unknown;
209209
}
210-
len = asprintf(&v, "type=%s msg=%.*s",
210+
len = asprintf(&v, "type=%s msg=%.*s\n",
211211
type, hdr->size, data);
212212
} else if (inbound_protocol == F_BINARY &&
213213
hdr->ver == AUDISP_PROTOCOL_VER2) {
214214
// Protocol 2 events are already formatted
215-
len = asprintf(&v, "%.*s", hdr->size, data);
215+
len = asprintf(&v, "%.*s\n", hdr->size, data);
216216
} else
217217
len = 0;
218218
} else if (inbound_protocol == F_STRING) {
219219
// Inbound strings start at the hdr
220-
len = asprintf(&v, "%s", (char *)hdr);
220+
len = asprintf(&v, "%s\n", (char *)hdr);
221221
} else
222222
len = 0;
223223
if (len <= 0) {
@@ -226,7 +226,7 @@ static int event_to_string(struct audit_dispatcher_header *hdr,
226226
return -1;
227227
}
228228

229-
/* Strip newlines from event record */
229+
/* Strip newlines from event record except the last one */
230230
ptr = v;
231231
while ((ptr = strchr(ptr, 0x0A)) != NULL) {
232232
if (ptr != &v[len-1])

0 commit comments

Comments
 (0)