From 3085928ca150b051c775d5130471d6ec398dc228 Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Tue, 15 Mar 2016 12:04:18 +0000 Subject: [PATCH] NUL-terminate upload response buffer --- extension/extension.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extension/extension.cpp b/extension/extension.cpp index 6deddd2..8416557 100644 --- a/extension/extension.cpp +++ b/extension/extension.cpp @@ -309,7 +309,10 @@ bool UploadAndDeleteCrashDump(const char *path, char *response, int maxlen) if (response) { if (uploaded) { - g_pSM->Format(response, maxlen, "%s", data.GetBuffer()); + int responseSize = data.GetSize(); + if (responseSize >= maxlen) responseSize = maxlen - 1; + strncpy(response, data.GetBuffer(), responseSize); + response[responseSize] = '\0'; } else { g_pSM->Format(response, maxlen, "%s (%d)", xfer->LastErrorMessage(), xfer->LastErrorCode()); }