diff options
-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;
|