From 3cf3d0fbb0576ab0eaa3f9f0f0ca19d15192d0d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 5 Jul 2008 21:43:58 +0200 Subject: [PATCH] correctly terminate extracted strings --- ED2KLink.cpp | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.7.4