[mapguide-commits] r9239 - sandbox/adsk/3.1n/Web/src/IsapiAgent

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Sep 21 00:10:31 PDT 2017


Author: christinebao
Date: 2017-09-21 00:10:31 -0700 (Thu, 21 Sep 2017)
New Revision: 9239

Modified:
   sandbox/adsk/3.1n/Web/src/IsapiAgent/IsapiResponseHandler.cpp
Log:
#2750: Isapi mapagent crashes when server error message is too long

Merge fix for #2750 to sandbox/adsk/3.1n branch.

Modified: sandbox/adsk/3.1n/Web/src/IsapiAgent/IsapiResponseHandler.cpp
===================================================================
--- sandbox/adsk/3.1n/Web/src/IsapiAgent/IsapiResponseHandler.cpp	2017-09-19 14:27:03 UTC (rev 9238)
+++ sandbox/adsk/3.1n/Web/src/IsapiAgent/IsapiResponseHandler.cpp	2017-09-21 07:10:31 UTC (rev 9239)
@@ -249,12 +249,15 @@
 
 void IsapiResponseHandler::WriteContext(const char *pszFormat, ...)
 {
-    char szBuffer[4096];
+    char* szBuffer;
+    int len;
     va_list arg_ptr;
     va_start(arg_ptr, pszFormat);
-    vsprintf(szBuffer, pszFormat, arg_ptr);
+    len = _vscprintf(pszFormat, arg_ptr) + 1;
+    szBuffer = (char*)malloc(len * sizeof(char));
+    vsprintf_s(szBuffer, len, pszFormat, arg_ptr);
     va_end(arg_ptr);
-
     DWORD dwSize = (DWORD)strlen(szBuffer);
     m_pECB->WriteClient(m_pECB->ConnID, szBuffer, &dwSize, 0);
+    free(szBuffer);
 }



More information about the mapguide-commits mailing list