summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-06-15 10:35:04 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2013-06-20 10:53:58 +0200
commit709038652854b71895e06caed2b028b389acefd6 (patch)
tree31ca797f03a9bd6405e6b57d5826263dc9d79796
parent2ecf54d8704f93f086df7def08e80f49892ac075 (diff)
support \n and \r\n line endings in ReadMessages
-rw-r--r--apt-pkg/contrib/strutl.cc5
-rw-r--r--debian/changelog1
2 files changed, 4 insertions, 2 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index f4dd3407d..d0e74d8c5 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -758,7 +758,8 @@ bool ReadMessages(int Fd, vector<string> &List)
// Look for the end of the message
for (char *I = Buffer; I + 1 < End; I++)
{
- if (I[0] != '\n' || I[1] != '\n')
+ if (I[1] != '\n' ||
+ (I[0] != '\n' && strncmp(I, "\r\n\r\n", 4) != 0))
continue;
// Pull the message out
@@ -766,7 +767,7 @@ bool ReadMessages(int Fd, vector<string> &List)
PartialMessage += Message;
// Fix up the buffer
- for (; I < End && *I == '\n'; I++);
+ for (; I < End && (*I == '\n' || *I == '\r'); ++I);
End -= I-Buffer;
memmove(Buffer,I,End-Buffer);
I = Buffer;
diff --git a/debian/changelog b/debian/changelog
index 8fef47d14..dfff872a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,7 @@ apt (0.9.8.3) UNRELEASED; urgency=low
* fix file location for configure-index.gz in apt.conf(5) (Closes: #711921)
* handle missing "Description" in apt-cache show (Closes: #712435)
* try defaults if auto-detection failed in apt-cdrom (Closes: #712433)
+ * support \n and \r\n line endings in ReadMessages
-- David Kalnischkies <kalnischkies@gmail.com> Sun, 09 Jun 2013 15:06:24 +0200