[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#495906: marked as done (apt: End of message missed when "\n\n" spans two reads in ReadMessages)



Your message dated Tue, 11 Aug 2015 14:56:22 +0200
with message-id <20150811125621.GA18357@crossbow>
and subject line Re: apt: End of message missed when "\n\n" spans two reads in ReadMessages
has caused the Debian Bug report #495906,
regarding apt: End of message missed when "\n\n" spans two reads in ReadMessages
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
495906: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495906
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: apt
Version: 0.7.14
Severity: normal
Tags: patch

ReadMessages() (in apt-pkg/contrib/strutl.cc) misses the end of a
message when the "\n\n" combination spans two reads. This is because the
first partial read is entirely put in PartialMessage and the test (I[0]
!= '\n' || I[1] != '\n') ignores the contents of PartialMessage.

The patch below should fix this:

--- strutl.cc.orig	2008-05-28 14:22:14.000000000 +0100
+++ strutl.cc	2008-08-21 09:28:05.010859100 +0100
@@ -720,8 +720,11 @@ bool ReadMessages(int Fd, vector<string>
 	  // in PartialMessage and throw the rest of the buffer
   	  // away.  This allows us to handle messages that
   	  // are longer than the static buffer size.
-	  PartialMessage += string(Buffer, End);
-	  End = Buffer;
+	  // The last byte is left in Buffer so that a \n\n combination
+	  // that spans the two reads is still detected
+	  PartialMessage += string(Buffer, End-1);
+	  Buffer[0] = Buffer[End-1];
+	  End = Buffer + 1;
   	}
       else
       	{


-- Package-specific info:

-- (no /etc/apt/preferences present) --


-- (/etc/apt/sources.list present, but not submitted) --


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: armel (armv5tejl)

Kernel: Linux 2.6.16.16-arm1
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages apt depends on:
ii  debian-archive-keyring   2008.04.16+nmu1 GnuPG archive keys of the Debian a
ii  libc6                    2.7-13          GNU C Library: Shared libraries
ii  libgcc1                  1:4.3.1-2       GCC support library
ii  libstdc++6               4.3.1-2         The GNU Standard C++ Library v3

apt recommends no packages.

Versions of packages apt suggests:
pn  apt-doc                       <none>     (no description available)
ii  aptitude                      0.4.11.8-1 terminal-based package manager
ii  bzip2                         1.0.5-1    high-quality block-sorting file co
ii  dpkg-dev                      1.14.20    Debian package development tools
ii  lzma                          4.43-14    Compression method of 7z format in

-- no debconf information



--- End Message ---
--- Begin Message ---
Version: 1.1~exp8

Hi,

On Thu, Aug 21, 2008 at 10:32:03AM +0100, Steven Price wrote:
> ReadMessages() (in apt-pkg/contrib/strutl.cc) misses the end of a
> message when the "\n\n" combination spans two reads. This is because the
> first partial read is entirely put in PartialMessage and the test (I[0]
> != '\n' || I[1] != '\n') ignores the contents of PartialMessage.

Right & thanks for the patch btw.

"Unfortunately" we fixed this differently with a 'rewrite' as there were
some other problems with it as well around the cut-point. On the upside
the commit fixing it also includes a testcase so we should never get
accidentally reimplement this bug…
https://anonscm.debian.org/cgit/apt/apt.git/commit/?id=d8c71b3b5dc98daa247433503ad8242c9e7b77db

Closing this bugreport as done hence.


Best regards

David Kalnischkies

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply to: