[commit] r2382 - trunk/GME/Gme

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Tue Oct 8 09:18:52 CDT 2013


Author: ksmyth
Date: Tue Oct  8 09:18:52 2013
New Revision: 2382

Log:
Fix: buffers too small for long pathnames in XML upgrade. CrashRpt f537f881-6162-4908-839a-09e3aef9195a

Modified:
   trunk/GME/Gme/GMEApp.cpp

Modified: trunk/GME/Gme/GMEApp.cpp
==============================================================================
--- trunk/GME/Gme/GMEApp.cpp	Thu Oct  3 11:16:50 2013	(r2381)
+++ trunk/GME/Gme/GMEApp.cpp	Tue Oct  8 09:18:52 2013	(r2382)
@@ -2447,8 +2447,8 @@
 		DeleteFile(backupname);
 		if(!MoveFile(fname, backupname)) {
 			backupname = fname;
-			TCHAR buf[300];
-			_stprintf_s( buf, _T("Could not save original file '%s' to '%s'"), 
+			CString buf;
+			buf.Format(L"Could not save original file '%s' to '%s'",
 				static_cast<const TCHAR*>(fname), static_cast<const TCHAR*>(backupname)); 
 			AfxMessageBox(buf);
 			COMTHROW(E_NOTFOUND);
@@ -2482,16 +2482,17 @@
 		}
 	}
 	catch(hresult_exception &e)	{
-		TCHAR buf[200];
 		if(backupname.IsEmpty()) {
-			_stprintf_s(buf, _T("The upgrade failed: 0x%x\nThe model has not been closed"), e.hr);
+			CString buf;
+			buf.Format(L"The upgrade failed: 0x%x\nThe model has not been closed", e.hr);
 			AfxMessageBox(buf);
 		}
 		else {
 			if(backupname.Compare(fname)) {
 				if(MoveFile(backupname, fname)) backupname = fname;
 			}
-			_stprintf_s(buf, _T("The upgrade failed: 0x%x\nThe original model is in file %s"), e.hr, 
+			CString buf;
+			buf.Format(L"The upgrade failed: 0x%x\nThe original model is in file %s", e.hr, 
 				static_cast<const TCHAR*>(backupname));
 			AfxMessageBox(buf);
 		}


More information about the gme-commit mailing list