From 691372307831cec3269ed31e48f614eab2f65c7d Mon Sep 17 00:00:00 2001 From: Claude Bing Date: Tue, 21 Aug 2018 12:27:13 -0400 Subject: [PATCH] Fix growbuffer_append This fixes the following error encountered when uploading large files: ERROR: ErrorMalformedXML Message: The XML you provided was not well-formed or did not validate against our published schema. This becomes a problem after a previous patch increases the size limit for a single object, causing more than one growbuffer to be allocated for holding the XML. --- src/s3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/s3.c b/src/s3.c index 45c733c..2ac76eb 100644 --- a/src/s3.c +++ b/src/s3.c @@ -426,7 +426,7 @@ typedef struct growbuffer // returns nonzero on success, zero on out of memory static int growbuffer_append(growbuffer **gb, const char *data, int dataLen) { - int toCopy = 0 ; + int origDataLen = dataLen; while (dataLen) { growbuffer *buf = *gb ? (*gb)->prev : 0; if (!buf || (buf->size == sizeof(buf->data))) { @@ -448,7 +448,7 @@ static int growbuffer_append(growbuffer **gb, const char *data, int dataLen) } } - toCopy = (sizeof(buf->data) - buf->size); + int toCopy = (sizeof(buf->data) - buf->size); if (toCopy > dataLen) { toCopy = dataLen; } @@ -458,7 +458,7 @@ static int growbuffer_append(growbuffer **gb, const char *data, int dataLen) buf->size += toCopy, data += toCopy, dataLen -= toCopy; } - return toCopy; + return origDataLen; }