Fossil SCM

Fix a use-after-free when printing the "home directory must be writable" error message.

drh 2021-10-08 12:18 trunk
Commit aad4b78936f1543ffe2ee38deb8d27d4f77ae76b64e018ebceb24ff7b1c389c4
1 file changed +1 -1
+1 -1
--- src/db.c
+++ src/db.c
@@ -1914,16 +1914,16 @@
19141914
int rc;
19151915
if( file_isdir(zHome, ExtFILE)==0 ){
19161916
file_mkdir(zHome, ExtFILE, 0);
19171917
}
19181918
rc = file_access(zHome, W_OK);
1919
- fossil_free(zHome);
19201919
if( rc ){
19211920
if( isOptional ) return 0;
19221921
fossil_fatal("home directory \"%s\" must be writeable", zHome);
19231922
}
19241923
db_init_database(zDbName, zConfigSchema, (char*)0);
1924
+ fossil_free(zHome);
19251925
}
19261926
if( file_access(zDbName, W_OK) ){
19271927
if( isOptional ) return 0;
19281928
fossil_fatal("configuration file %s must be writeable", zDbName);
19291929
}
19301930
--- src/db.c
+++ src/db.c
@@ -1914,16 +1914,16 @@
1914 int rc;
1915 if( file_isdir(zHome, ExtFILE)==0 ){
1916 file_mkdir(zHome, ExtFILE, 0);
1917 }
1918 rc = file_access(zHome, W_OK);
1919 fossil_free(zHome);
1920 if( rc ){
1921 if( isOptional ) return 0;
1922 fossil_fatal("home directory \"%s\" must be writeable", zHome);
1923 }
1924 db_init_database(zDbName, zConfigSchema, (char*)0);
 
1925 }
1926 if( file_access(zDbName, W_OK) ){
1927 if( isOptional ) return 0;
1928 fossil_fatal("configuration file %s must be writeable", zDbName);
1929 }
1930
--- src/db.c
+++ src/db.c
@@ -1914,16 +1914,16 @@
1914 int rc;
1915 if( file_isdir(zHome, ExtFILE)==0 ){
1916 file_mkdir(zHome, ExtFILE, 0);
1917 }
1918 rc = file_access(zHome, W_OK);
 
1919 if( rc ){
1920 if( isOptional ) return 0;
1921 fossil_fatal("home directory \"%s\" must be writeable", zHome);
1922 }
1923 db_init_database(zDbName, zConfigSchema, (char*)0);
1924 fossil_free(zHome);
1925 }
1926 if( file_access(zDbName, W_OK) ){
1927 if( isOptional ) return 0;
1928 fossil_fatal("configuration file %s must be writeable", zDbName);
1929 }
1930

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button