From 020dbce21875d369130853dc922b17446ae63ca5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 14 Jun 2016 10:38:41 +0000 Subject: fix for a rare crash inside netlib git-svn-id: http://svn.miranda-ng.org/main/trunk@16972 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/netlibhttp.cpp | 5 +++-- 1 file 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; -- cgit v1.2.3