summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-09-12 19:48:52 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-09-12 19:48:52 +0000
commit9f0a1dbca0ae937808dbbe1ad754428b75c2c70b (patch)
tree35861a99ae070971cbd1371a8b83832dfc1adc43 /src/mir_app
parent364e8cd84bf31e34a7c3730f814e58acd18e72b8 (diff)
wrong http headers processing
git-svn-id: http://svn.miranda-ng.org/main/trunk@15336 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/netlibhttp.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp
index 88f657022f..187adbc7e7 100644
--- a/src/mir_app/src/netlibhttp.cpp
+++ b/src/mir_app/src/netlibhttp.cpp
@@ -1007,32 +1007,32 @@ char* gzip_decode(char *gzip_data, int *len_ptr, int window)
static int NetlibHttpRecvChunkHeader(NetlibConnection *nlc, bool first, DWORD flags)
{
- char data[64], *peol1;
+ char data[1000];
- while(true) {
- int recvResult = NLRecv(nlc, data, 31, MSG_RAW | MSG_PEEK);
- if (recvResult <= 0)
+ while (true) {
+ int recvResult = NLRecv(nlc, data, _countof(data)-1, MSG_RAW | MSG_PEEK);
+ if (recvResult <= 0 || recvResult >= _countof(data))
return SOCKET_ERROR;
data[recvResult] = 0;
- peol1 = strchr(data, '\n');
- if (peol1 != NULL) {
- char *peol2 = first ? peol1 : strchr(peol1 + 1, '\n');
- if (peol2 != NULL) {
- int sz = peol2 - data + 1;
- int r = strtol(first ? data : peol1 + 1, NULL, 16);
- if (r == 0) {
- char *peol3 = strchr(peol2 + 1, '\n');
- if (peol3 == NULL) continue;
- sz = peol3 - data + 1;
- }
- NLRecv(nlc, data, sz, MSG_RAW | flags);
- return r;
- }
- else if (recvResult >= 31)
- return SOCKET_ERROR;
+ char *peol1 = strchr(data, '\n');
+ if (peol1 == NULL)
+ continue;
+
+ char *peol2 = first ? peol1 : strchr(peol1 + 1, '\n');
+ if (peol2 == NULL)
+ continue;
+
+ int sz = peol2 - data + 1;
+ int r = strtol(first ? data : peol1 + 1, NULL, 16);
+ if (r == 0) {
+ char *peol3 = strchr(peol2 + 1, '\n');
+ if (peol3 == NULL) continue;
+ sz = peol3 - data + 1;
}
+ NLRecv(nlc, data, sz, MSG_RAW | flags);
+ return r;
}
}