From 0e51cec3d2d8b91d4d79379f691b53c2a0c76ec6 Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Mon, 16 Jul 2018 22:49:22 +0300
Subject: fix for buffer overrun

---
 plugins/Weather/src/weather_http.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'plugins/Weather/src')

diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp
index 1209648d64..63ea78b03a 100644
--- a/plugins/Weather/src/weather_http.cpp
+++ b/plugins/Weather/src/weather_http.cpp
@@ -136,9 +136,9 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s
 	}
 	// return error code if the recieved code is neither 200 OK nor 302 Moved
 	else {
-		*szData = (wchar_t*)mir_alloc(512);
 		// store the error code in szData
-		mir_snwprintf(*szData, 512, L"Error occured! HTTP Error: %i\n", nlhrReply->resultCode);
+		CMStringW wszError(FORMAT, L"Error occured! HTTP Error: %i\n", nlhrReply->resultCode);
+		*szData = wszError.Detach();
 		result = nlhrReply->resultCode;
 	}
 
-- 
cgit v1.2.3