diff options
author | George Hazan <george.hazan@gmail.com> | 2016-06-14 10:38:41 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-06-14 10:38:41 +0000 |
commit | 020dbce21875d369130853dc922b17446ae63ca5 (patch) | |
tree | 5f3e95078fce9d00e3f5d3f7f0e796e61036803a | |
parent | 545ca2edec49b7aed688bec052cc6609f68b39ed (diff) |
fix for a rare crash inside netlib
git-svn-id: http://svn.miranda-ng.org/main/trunk@16972 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | src/mir_app/src/netlibhttp.cpp | 5 |
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;
|