From: David ‘Bombe’ Roden Date: Sat, 5 Jul 2008 19:43:58 +0000 (+0200) Subject: correctly terminate extracted strings X-Git-Tag: 0.1~23 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=3cf3d0fbb0576ab0eaa3f9f0f0ca19d15192d0d0;p=ecparse.git correctly terminate extracted strings --- diff --git a/ED2KLink.cpp b/ED2KLink.cpp index 05b8d97..47f3af8 100644 --- a/ED2KLink.cpp +++ b/ED2KLink.cpp @@ -72,6 +72,7 @@ ED2KLink* ED2KLink::parseED2KLink(const char* buffer) { growingBuffer.write(tempBuffer, (char*) pipeIndex - tempBuffer); filename = (char*) malloc(growingBuffer.getLimit() + 1); growingBuffer.read(filename, growingBuffer.getLimit()); + sizeString[growingBuffer.getLimit()] = '\0'; growingBuffer.clear(); tempBuffer = pipeIndex + 1; @@ -85,6 +86,7 @@ ED2KLink* ED2KLink::parseED2KLink(const char* buffer) { growingBuffer.write(tempBuffer, (char*) pipeIndex - tempBuffer); sizeString = (char*) malloc(growingBuffer.getLimit() + 1); growingBuffer.read(sizeString, growingBuffer.getLimit()); + sizeString[growingBuffer.getLimit()] = '\0'; growingBuffer.clear(); tempBuffer = pipeIndex + 1;