diff --git a/CMakeLists.txt b/CMakeLists.txt index 75705fb..d263f29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,5 +67,4 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE WIN32_LEAN_AND_MEAN - HAVE_CONFIG_H - _CRT_NON_CONFORMING_WCSTOK) + HAVE_CONFIG_H) diff --git a/as.c b/as.c index 4fb9d8b..f44e972 100644 --- a/as.c +++ b/as.c @@ -77,7 +77,8 @@ ExtractProfileName(const WCHAR *profile, const WCHAR *default_name, WCHAR *out_n WCHAR *buf = _wcsdup(profile); WCHAR *pch = NULL; - pch = wcstok(buf, L"\r\n"); + WCHAR *ctx = NULL; + pch = wcstok(buf, L"\r\n", &ctx); while (pch != NULL) { if (wcsbegins(pch, PROFILE_NAME_TOKEN)) { @@ -89,7 +90,7 @@ ExtractProfileName(const WCHAR *profile, const WCHAR *default_name, WCHAR *out_n friendly_name[PROFILE_NAME_LEN - 1] = L'\0'; } - pch = wcstok(NULL, L"\r\n"); + pch = wcstok(NULL, L"\r\n", &ctx); } /* we use .ovpn here, but extension could be customized */ diff --git a/proxy.c b/proxy.c index 7a51d6c..e424779 100644 --- a/proxy.c +++ b/proxy.c @@ -475,7 +475,8 @@ ParseProxyString(LPWSTR proxy_str, url_scheme scheme, return; LPCWSTR delim = L"; "; - LPWSTR token = wcstok(proxy_str, delim); + LPWSTR *ctx = NULL; + LPWSTR token = wcstok(proxy_str, delim, &ctx); LPCWSTR scheme_str = UrlSchemeStr(scheme); LPCWSTR socks_str = UrlSchemeStr(SOCKS_URL); @@ -545,7 +546,7 @@ ParseProxyString(LPWSTR proxy_str, url_scheme scheme, break; } - token = wcstok(NULL, delim); + token = wcstok(NULL, delim, &ctx); } }