diff options
author | drh <> | 2021-10-02 17:12:58 +0000 |
---|---|---|
committer | drh <> | 2021-10-02 17:12:58 +0000 |
commit | cc9309c7977dbe7f95f1f8c787b7587da3c88c7c (patch) | |
tree | 46c00876824078bb4ab3f2b8374285668c6bc963 /src | |
parent | 76fc88fe0fe434f1f428cef0503e1224800fab7c (diff) | |
download | sqlite-cc9309c7977dbe7f95f1f8c787b7587da3c88c7c.tar.gz sqlite-cc9309c7977dbe7f95f1f8c787b7587da3c88c7c.zip |
Make the sqlite3_filename_xxxx() interfaces robust against NULL pointer
arguments, even though the documentation says the behavior is undefined
in that case.
FossilOrigin-Name: dd64c60bab4e2b44419db6882dfcc80b73d733ebe3bea64a7588c33fbc428234
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c index 65fe4a668..c44b9b470 100644 --- a/src/main.c +++ b/src/main.c @@ -4487,9 +4487,11 @@ sqlite3_int64 sqlite3_uri_int64( ** corruption. */ const char *sqlite3_filename_database(const char *zFilename){ + if( zFilename==0 ) return 0; return databaseName(zFilename); } const char *sqlite3_filename_journal(const char *zFilename){ + if( zFilename==0 ) return 0; zFilename = databaseName(zFilename); zFilename += sqlite3Strlen30(zFilename) + 1; while( zFilename[0] ){ @@ -4503,7 +4505,7 @@ const char *sqlite3_filename_wal(const char *zFilename){ return 0; #else zFilename = sqlite3_filename_journal(zFilename); - zFilename += sqlite3Strlen30(zFilename) + 1; + if( zFilename ) zFilename += sqlite3Strlen30(zFilename) + 1; return zFilename; #endif } |