mirror of https://github.com/OpenVPN/openvpn-gui
Replace _wfopen with _wfopen_s
Avoid warning C4996: '_wfopen': This function or variable may be unsafe Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>master
parent
ec77d99c40
commit
2721540f89
4
as.c
4
as.c
|
@ -662,8 +662,8 @@ again:
|
|||
}
|
||||
swprintf(out_path, out_path_size, L"%ls%ls", out_path, name);
|
||||
out_path[out_path_size - 1] = '\0';
|
||||
FILE *f = _wfopen(out_path, L"w");
|
||||
if (f == NULL)
|
||||
FILE *f;
|
||||
if (_wfopen_s(&f, out_path, L"w"))
|
||||
{
|
||||
MessageBoxW(hWnd, L"Unable to save downloaded profile", _T(PACKAGE_NAME), MB_OK);
|
||||
goto done;
|
||||
|
|
|
@ -183,11 +183,7 @@ config_parse(wchar_t *fname)
|
|||
FILE *fd = NULL;
|
||||
config_entry_t *head, *tail;
|
||||
|
||||
if (fname)
|
||||
{
|
||||
fd = _wfopen(fname, L"r");
|
||||
}
|
||||
if (!fd)
|
||||
if (!fname || _wfopen_s(&fd, fname, L"r"))
|
||||
{
|
||||
MsgToEventLog(EVENTLOG_ERROR_TYPE, L"Error opening <%ls> in config_parse", fname);
|
||||
return NULL;
|
||||
|
|
2
main.c
2
main.c
|
@ -202,7 +202,7 @@ _tWinMain(HINSTANCE hThisInstance,
|
|||
|
||||
#ifdef DEBUG
|
||||
/* Open debug file for output */
|
||||
if (!(o.debug_fp = _wfopen(DEBUG_FILE, L"a+,ccs=UTF-8")))
|
||||
if (_wfopen_s(&o.debug_fp, DEBUG_FILE, L"a+,ccs=UTF-8"))
|
||||
{
|
||||
/* can't open debug file */
|
||||
ShowLocalizedMsg(IDS_ERR_OPEN_DEBUG_FILE, DEBUG_FILE);
|
||||
|
|
5
misc.c
5
misc.c
|
@ -937,8 +937,9 @@ ParseManagementAddress(connection_t *c)
|
|||
wcsncpy_s(pw_path, MAX_PATH, pw_file, _TRUNCATE);
|
||||
}
|
||||
|
||||
FILE *fp = _wfopen(pw_path, L"r");
|
||||
if (!fp || !fgets(c->manage.password, sizeof(c->manage.password), fp))
|
||||
FILE *fp;
|
||||
if (_wfopen_s(&fp, pw_path, L"r")
|
||||
|| !fgets(c->manage.password, sizeof(c->manage.password), fp))
|
||||
{
|
||||
/* This may be normal as not all users may be given access to this secret */
|
||||
ret = false;
|
||||
|
|
|
@ -38,7 +38,7 @@ init_debug()
|
|||
{
|
||||
if (!fp)
|
||||
{
|
||||
fp = _wfopen(L"C:\\Windows\\Temp\\openvpn-plap-debug.txt", L"a+,ccs=UTF-8");
|
||||
_wfopen_s(&fp, L"C:\\Windows\\Temp\\openvpn-plap-debug.txt", L"a+,ccs=UTF-8");
|
||||
}
|
||||
InitializeCriticalSection(&log_write);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue