summaryrefslogtreecommitdiff
path: root/methods/http.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-01-10 16:46:30 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2006-01-10 16:46:30 +0000
commitc5691ddf15797bead5d77021ee0524635798bebb (patch)
treec36d42b4b2c01d6582a22d2fa4083f07777f3b75 /methods/http.cc
parent610a00396d7bb5c9412cdecdc645be2f54a7188b (diff)
parent927c393f1305925c1456c931e1e7b45afd6f051d (diff)
* fix http data corruption (#280844)
Patches applied: * mvo@debian.org--2005/apt--debian-experimental--0--patch-12 * added http data corruption fix patch (#280844)
Diffstat (limited to 'methods/http.cc')
-rw-r--r--methods/http.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/methods/http.cc b/methods/http.cc
index dc3f0b763..341de94e3 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -241,28 +241,23 @@ bool CircleBuf::WriteTillEl(string &Data,bool Single)
if (Buf[I%Size] != '\n')
continue;
++I;
- if (I < InP && Buf[I%Size] == '\r')
- ++I;
if (Single == false)
{
- if (Buf[I%Size] != '\n')
- continue;
- ++I;
if (I < InP && Buf[I%Size] == '\r')
++I;
+ if (I >= InP || Buf[I%Size] != '\n')
+ continue;
+ ++I;
}
- if (I > InP)
- I = InP;
-
Data = "";
while (OutP < I)
{
unsigned long Sz = LeftWrite();
if (Sz == 0)
return false;
- if (I - OutP < LeftWrite())
+ if (I - OutP < Sz)
Sz = I - OutP;
Data += string((char *)(Buf + (OutP%Size)),Sz);
OutP += Sz;