File: 0015-threaded-dest_Fix_integer_overflow.patch

package info (click to toggle)
syslog-ng 3.19.1-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 13,176 kB
  • sloc: ansic: 114,472; makefile: 4,697; sh: 4,391; python: 4,282; java: 4,047; xml: 2,435; yacc: 1,108; lex: 426; perl: 193; awk: 184
file content (27 lines) | stat: -rw-r--r-- 951 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From 742a16f5f11f34fa32423bd9b960da7023bdd24e Mon Sep 17 00:00:00 2001
From: Attila Szakacs <attila.szakacs@balabit.com>
Date: Thu, 24 Jan 2019 16:12:01 +0100
Subject: [PATCH] threaded-dest: Fix integer overflow

A negative number's modulo will be negative, which in our
case pointed to a negative entry of the workers array,
causing segfault.

Signed-off-by: Attila Szakacs <attila.szakacs@balabit.com>
---
 lib/logthrdestdrv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/logthrdestdrv.c b/lib/logthrdestdrv.c
index 8e8dff6c4b..e160e972fc 100644
--- a/lib/logthrdestdrv.c
+++ b/lib/logthrdestdrv.c
@@ -857,7 +857,7 @@ log_threaded_dest_driver_set_max_retries(LogDriver *s, gint max_retries)
 LogThreadedDestWorker *
 _lookup_worker(LogThreadedDestDriver *self, LogMessage *msg)
 {
-  static gint last_worker = 0;
+  static guint last_worker = 0;
 
   gint worker_index = last_worker % self->num_workers;
   last_worker++;