fix resizing of buffer
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 5 Jul 2008 17:22:49 +0000 (19:22 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 5 Jul 2008 17:22:49 +0000 (19:22 +0200)
GrowingBuffer.cpp

index 8e3bd4a..2841741 100644 (file)
@@ -58,7 +58,7 @@ void GrowingBuffer::write(const void* buffer, size_t length) {
                } while (length > (newSize - limit));
                GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] resizing buffer from %d to %d bytes to fit in %d bytes.\n", __FILE__, __LINE__, size, newSize, length);
                void* newData = malloc(newSize);
-               memcpy(newData, data, position);
+               memcpy(newData, data, limit);
                free(data);
                data = newData;
        }