~ubuntu-branches/ubuntu/trusty/syslog-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/logproto-Fix-log_proto_file_writer_flush-s-partial-construction.patch

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS), Gergely Nagy
  • Date: 2011-10-11 14:30:48 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20111011143048-r1iljux9xbvj3lwh
Tags: 3.3.1.dfsg-1
* New upstream release with important fixes from upstream git tree with
  non-free manpages removed.
* Drop syslog-ng.conf(5) (closes: #496521).
* syslog-ng(8) is generated, and does not mention -Q anymore
  (closes: #616069).
* Supports CAP_SYSLOG on recent kernels (closes: #630172).
* Does not use g_timeout_add_seconds anymore (closes: #609154).

[ Gergely Nagy <algernon@madhouse-project.org> ]
* Update debian/copyright to DEP-5 format.
* Simplified the logrotate file by merging identical entries.
* Include local configuration files from /etc/syslog-ng/conf.d/ (Closes:
  #609050).
* Update syslog-ng.conf to be fully 3.3 compliant.
* Compress both source and binaries (except the syslog-ng meta
  package) with xz, instead of gzip.
* Use dpkg triggers to restart syslog-ng when appropriate.
* Include DFSG-free manual pages for all binaries.
* Build with Hardening enabled.
* Mention syslog(3) in /etc/default/syslog-ng, instead of
  <linux/kernel.h> (Closes: #608605)
* Support 'status' in the init script.
  Patch from Peter Eisentraut <petere@debian.org> (Closes: #644458)
* Build-Depend on libevtlog-dev (>= 0.2.12-5~) for correct shlibs.
* Use [linux-any] in Build-Depends instead of hardcoded links.
  (Closes: #634715)
* Use $SYSLOGNG_OPTS in the init script when reloading syslog-ng.
  (Closes: #589081)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From c7fb3470c6140786fa97e35f1d488ce6a0b7af4e Mon Sep 17 00:00:00 2001
 
2
From: Balazs Scheidler <bazsi@balabit.hu>
 
3
Date: Sat, 29 Oct 2011 16:31:18 +0200
 
4
Subject: [PATCH] logproto: Fix log_proto_file_writer_flush()'s partial
 
5
 construction.
 
6
 
 
7
If the log messages has different length and only a partial write
 
8
happen the log_proto_file_writer_flush there are a possible buffer
 
9
under/overflow happen.
 
10
 
 
11
The problematic part is in the calculation about the last written
 
12
byte of the last written message. The calculation is not just too
 
13
difficult to follow but use the wrong message length in it.
 
14
Because of this ther are buffer under/overflow may happen or
 
15
starting to read the message in wrong position, causing messing the
 
16
log.
 
17
 
 
18
Signed-off-by: SZALAY Attila <sasa@balabit.hu>
 
19
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
 
20
---
 
21
 lib/logproto.c |    5 +++--
 
22
 1 files changed, 3 insertions(+), 2 deletions(-)
 
23
 
 
24
diff --git a/lib/logproto.c b/lib/logproto.c
 
25
index bdf9695..282064c 100644
 
26
--- a/lib/logproto.c
 
27
+++ b/lib/logproto.c
 
28
@@ -256,7 +256,7 @@ static LogProtoStatus
 
29
 log_proto_file_writer_flush(LogProto *s)
 
30
 {
 
31
   LogProtoFileWriter *self = (LogProtoFileWriter *)s;
 
32
-  gint rc, i, i0, sum, ofs;
 
33
+  gint rc, i, i0, sum, ofs, pos;
 
34
 
 
35
   /* we might be called from log_writer_deinit() without having a buffer at all */
 
36
 
 
37
@@ -299,7 +299,8 @@ log_proto_file_writer_flush(LogProto *s)
 
38
       /* allocate and copy the remaning data */
 
39
       self->partial = (guchar *)g_malloc(self->partial_len);
 
40
       ofs = sum - rc; /* the length of the remaning (not processed) chunk in the first message */
 
41
-        memcpy(self->partial, self->buffer[i0].iov_base + rc - (i0 > 0 ? (sum - self->buffer[i0 - 1].iov_len) : 0), ofs);
 
42
+      pos = self->buffer[i0].iov_len - ofs;
 
43
+      memcpy(self->partial, self->buffer[i0].iov_base + pos, ofs);
 
44
       i = i0 + 1;
 
45
       while (i < self->buf_count)
 
46
         {
 
47
-- 
 
48
1.7.7
 
49