1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

New defenses against OOM and corrupt database problems in the CLI.

FossilOrigin-Name: 5c9fd7fde16d8e335488b8bf5c691961d2636201b034d1f29d25de8708de291d
This commit is contained in:
drh
2021-12-16 17:35:27 +00:00
parent aca5e49caa
commit 621a5e0c47
5 changed files with 33 additions and 19 deletions

View File

@ -368,10 +368,11 @@ static int writeFile(
mode_t mode, /* MODE parameter passed to writefile() */
sqlite3_int64 mtime /* MTIME parameter (or -1 to not set time) */
){
if( zFile==0 ) return 1;
#if !defined(_WIN32) && !defined(WIN32)
if( S_ISLNK(mode) ){
const char *zTo = (const char*)sqlite3_value_text(pData);
if( symlink(zTo, zFile)<0 ) return 1;
if( zTo==0 || symlink(zTo, zFile)<0 ) return 1;
}else
#endif
{