Skip to content

Commit a212dee

Browse files
committed
Modify q_peek error handling in queue.c
audisp/plugins/remote/queue.c fails with EBADMSG when a queue entry lacks a terminating '\0', though a comment suggests the entry could simply be dropped. Updated q_peek to warn about queue entries missing a terminator, drop the invalid head, and retry the peek operation.
1 parent e7e1e67 commit a212dee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

audisp/plugins/remote/queue.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,10 @@ int q_peek(struct queue *q, char *buf, size_t size)
413413
data = q->buffer;
414414
end = memchr(q->buffer, '\0', q->entry_size);
415415
if (end == NULL) {
416-
/* FIXME: silently drop this entry? */
417-
errno = EBADMSG;
418-
return -1;
416+
syslog(LOG_WARNING, "queue entry missing terminator");
417+
if (q_drop_head(q) != 0)
418+
return -1;
419+
return q_peek(q, buf, size); // Return next one
419420
}
420421
data_size = (end - data) + 1;
421422

0 commit comments

Comments
 (0)