Author: cwittich
Date: Sun Jan 19 08:20:45 2014
New Revision: 61682
URL:
http://svn.reactos.org/svn/reactos?rev=61682&view=rev
Log:
[msconfig]
strsafe++
Modified:
trunk/reactos/base/applications/msconfig/freeldrpage.c
trunk/reactos/base/applications/msconfig/precomp.h
trunk/reactos/base/applications/msconfig/systempage.c
Modified: trunk/reactos/base/applications/msconfig/freeldrpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig/freeldrpage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig/freeldrpage.c [iso-8859-1] Sun Jan 19
08:20:45 2014
@@ -33,15 +33,27 @@
FILE * file;
UINT length;
LRESULT pos;
+ HRESULT hr;
- wcscpy(szBuffer, szDrive);
- wcscat(szBuffer, L"freeldr.ini");
+ hr = StringCbCopyW(szBuffer, sizeof(szBuffer), szDrive);
+ if (FAILED(hr))
+ return FALSE;
+
+ hr = StringCbCatW(szBuffer, sizeof(szBuffer), L"freeldr.ini");
+ if (FAILED(hr))
+ return FALSE;
file = _wfopen(szBuffer, L"rt");
if (!file)
{
- wcscpy(szBuffer, szDrive);
- wcscat(szBuffer, L"boot.ini");
+ hr = StringCbCopyW(szBuffer, sizeof(szBuffer), szDrive);
+ if (FAILED(hr))
+ return FALSE;
+
+ hr = StringCbCatW(szBuffer, sizeof(szBuffer), L"boot.ini");
+ if (FAILED(hr))
+ return FALSE;
+
file = _wfopen(szBuffer, L"rt");
if (!file)
return FALSE;
@@ -137,7 +149,7 @@
if (pos != LB_ERR)
{
LPARAM res = SendMessage((HWND)lParam, LB_GETITEMDATA, pos, 0);
- if (!res) //line is not a default one
+ if (!res) /* line is not a default one */
SendMessage((HWND)lParam, LB_SETCURSEL, Settings.szDefaultPos,
0);
else
Settings.szDefaultPos = pos;
Modified: trunk/reactos/base/applications/msconfig/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig/precomp.h [iso-8859-1] Sun Jan 19 08:20:45
2014
@@ -11,6 +11,7 @@
#include <tchar.h>
#include <stdio.h>
#include <shlobj.h>
+#include <strsafe.h>
#include "msconfig.h"
#include "resource.h"
Modified: trunk/reactos/base/applications/msconfig/systempage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig/systempage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig/systempage.c [iso-8859-1] Sun Jan 19 08:20:45
2014
@@ -23,9 +23,15 @@
FILE* file;
UINT length;
TVINSERTSTRUCT insert;
+ HRESULT hr;
- wcscpy(szBuffer, szPath);
- wcscat(szBuffer, L"\\system.ini");
+ hr = StringCbCopyW(szBuffer, sizeof(szBuffer), szPath);
+ if (FAILED(hr))
+ return FALSE;
+
+ hr = StringCbCatW(szBuffer, sizeof(szBuffer), L"\\system.ini");
+ if (FAILED(hr))
+ return FALSE;
file = _wfopen(szBuffer, L"rt");
if (!file)