Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: error C4996: 'fopen': This function or variable may be unsafe. #34

Closed
sgrebnov opened this issue Jun 9, 2016 · 7 comments
Closed

Comments

@sgrebnov
Copy link
Contributor

sgrebnov commented Jun 9, 2016

c:\temp\sqlcipher\plugins\cordova-sqlcipher-adapter\src\common\sqlite3.c(17959): error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_S ECURE_NO_WARNINGS. See online help for details. [C:\temp\sqlCipher\plugins\cordova-sqlcipher-adapter\src\windows\SQLite3-Win-RT\SQLite3\SQLite3.UWP\SQLite3.UWP.vcxproj]

Looks like this is due to the following change

af3d1ed

@brody4hire
Copy link
Collaborator

The quick workaround is to add a flag to src/windows/SQLite3-Win-RT/SQLite3/SQLite3.Shared.vcxitems to define _CRT_SECURE_NO_WARNINGS. The correct solution is to get this fixed in the upstream SQLCipher source. I will deal with this when I get a chance in the next couple weeks or so.

@sgrebnov
Copy link
Contributor Author

sgrebnov commented Jun 9, 2016

Great, thanks! Maybe it makes sense to temporary update sqlite3.c so it will be overridden with correct version during next update?

Change

#if defined(_WIN32) && (__STDC_VERSION__ > 199901L)
    if(fopen_s(&f, destination, "a") != 0){
#else
    f = fopen(destination, "a");
    if(f == 0){
#endif

To

#if defined(_WIN32) && (__STDC_VERSION__ > 199901L) || defined(SQLITE_OS_WINRT)
    if(fopen_s(&f, destination, "a") != 0){
#else
    f = fopen(destination, "a");
    if(f == 0){
#endif

@sgrebnov
Copy link
Contributor Author

sgrebnov commented Jun 9, 2016

Otherwise we can forgot to remove temporary added '_CRT_SECURE_NO_WARNINGS' flag. Or this is fine?

@brody4hire
Copy link
Collaborator

I have mixed feelings about this. On the one hand I like the quick solution that does not edit code until we get this resolved. On the other hand I would favor test with the solution that will be published in the future.

I will raise an issue on the SQLCipher project that this is still an issue and maybe you can jump into the discussion to help get this resolved.

@sgrebnov
Copy link
Contributor Author

sgrebnov commented Jun 9, 2016

Sounds good! This is fine as I'm not blocked and can work on #30 Replace libTomCrypt with OpenSSL crypto library in Windows version

@brody4hire
Copy link
Collaborator

I just filed sqlcipher/sqlcipher#174 to get this fixed upstream. I am happy to hear that you are not blocked.

brody4hire pushed a commit to cbforks/cordova-sqlcipher-adapter-dev that referenced this issue Jun 22, 2016
@brody4hire
Copy link
Collaborator

Fixed and fixed upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants