Skip to content

Commit 757eda1

Browse files
committed
Division by zero risk when restoring the queue
count % q_depth will divide by zero if q_depth is 0 (e.g., after teardown/reconfigure or if init is skipped). Add an explicit guard for q_depth == 0 before the modulo.
1 parent a22194d commit 757eda1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

audisp/queue.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ static int queue_load_file(int fd)
8383
if (fd < 0)
8484
return -1;
8585

86+
if (q_depth == 0) {
87+
syslog(LOG_ERR, "Queue depth is zero, cannot restore queue");
88+
return -1;
89+
}
8690
dup_fd = dup(fd);
8791
if (dup_fd < 0)
8892
return -1;

0 commit comments

Comments
 (0)