summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-06-14 10:38:41 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-06-14 10:38:41 +0000
commit020dbce21875d369130853dc922b17446ae63ca5 (patch)
tree5f3e95078fce9d00e3f5d3f7f0e796e61036803a /src
parent545ca2edec49b7aed688bec052cc6609f68b39ed (diff)
fix for a rare crash inside netlib
git-svn-id: http://svn.miranda-ng.org/main/trunk@16972 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/netlibhttp.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp
index 6d985dba28..cb811f339c 100644
--- a/src/mir_app/src/netlibhttp.cpp
+++ b/src/mir_app/src/netlibhttp.cpp
@@ -980,11 +980,12 @@ static int NetlibHttpRecvChunkHeader(NetlibConnection *nlc, bool first, DWORD fl
buf.append(data, recvResult); // add chunk
- char *peol1 = strchr(buf.data(), '\n');
+ const char *peol1 = (const char*)memchr(buf.data(), '\n', buf.length());
if (peol1 == NULL)
continue;
- const char *peol2 = first ? peol1 : strchr(peol1 + 1, '\n');
+ int cbRest = int(peol1 - buf.data()) + 1;
+ const char *peol2 = first ? peol1 : (const char*)memchr(peol1 + 1, '\n', buf.length() - cbRest);
if (peol2 == NULL)
continue;