Index: src/ch/ExceptionEx.h =================================================================== diff -u -r4c272b19c74694c428c943011f279ec064fbd894 -rd2b121c78f510b5384b8ef0ca80afbfd7f77fef7 --- src/ch/ExceptionEx.h (.../ExceptionEx.h) (revision 4c272b19c74694c428c943011f279ec064fbd894) +++ src/ch/ExceptionEx.h (.../ExceptionEx.h) (revision d2b121c78f510b5384b8ef0ca80afbfd7f77fef7) @@ -1,22 +1,21 @@ -/************************************************************************ - Copy Handler 1.x - program for copying data in Microsoft Windows - systems. - Copyright (C) 2001-2003 Ixen Gerthannes (ixen@interia.pl) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*************************************************************************/ +/*************************************************************************** +* Copyright (C) 2001-2008 by J�zef Starosczyk * +* ixen@copyhandler.com * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU Library General Public License * +* (version 2) as published by the Free Software Foundation; * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ /************************************************************************* File: Exception.h Version: 1.0 @@ -100,11 +99,15 @@ // helpers static TCHAR* FormatReason(PCTSTR pszReason, ...) { - TCHAR szBuf[1024]; + const size_t stMaxReason = 1024; + TCHAR szBuf[stMaxReason]; + va_list marker; va_start(marker, pszReason); - _vsntprintf(szBuf, 1024, pszReason, marker); + _vsntprintf(szBuf, stMaxReason - 1, pszReason, marker); + szBuf[stMaxReason - 1] = _T('\0'); va_end(marker); + TCHAR *pszData=new TCHAR[_tcslen(szBuf)+1]; _tcscpy(pszData, szBuf); return pszData; @@ -113,6 +116,8 @@ // formats max info about this exception virtual TCHAR* GetInfo(LPCTSTR pszDesc, TCHAR* pszStr, DWORD dwMaxLen) { + const size_t stMaxData = 1024; + // get the properties int iCount=RegisterInfo(NULL); __EXCPROPINFO *pepi=new __EXCPROPINFO[iCount]; @@ -130,7 +135,7 @@ size_t tIndex=_tcslen(pszStr); // format the info accordingly - TCHAR szData[1024]; + TCHAR szData[stMaxData]; for (int i=0;i