Fossil SCM

Resolve null-pointer deref when reading an empty .fossil-settings/empty-dirs, reported in [forum:9ff6a143fc | forum post 9ff6a143fc].

stephan 2023-06-10 09:03 trunk
Commit b1dc25e1fe327f09f29eba00ccf8033a6953f11d34573de9bf96f6be1d6ac470
1 file changed +1 -1
+1 -1
--- src/update.c
+++ src/update.c
@@ -654,11 +654,11 @@
654654
char *zEmptyDirs = db_get("empty-dirs", 0);
655655
if( zEmptyDirs!=0 ){
656656
int i;
657657
Glob *pGlob = glob_create(zEmptyDirs);
658658
659
- for(i=0; i<pGlob->nPattern; i++){
659
+ for(i=0; pGlob!=0 && i<pGlob->nPattern; i++){
660660
const char *zDir = pGlob->azPattern[i];
661661
char *zPath = mprintf("%s/%s", g.zLocalRoot, zDir);
662662
switch( file_isdir(zPath, RepoFILE) ){
663663
case 0: { /* doesn't exist */
664664
fossil_free(zPath);
665665
--- src/update.c
+++ src/update.c
@@ -654,11 +654,11 @@
654 char *zEmptyDirs = db_get("empty-dirs", 0);
655 if( zEmptyDirs!=0 ){
656 int i;
657 Glob *pGlob = glob_create(zEmptyDirs);
658
659 for(i=0; i<pGlob->nPattern; i++){
660 const char *zDir = pGlob->azPattern[i];
661 char *zPath = mprintf("%s/%s", g.zLocalRoot, zDir);
662 switch( file_isdir(zPath, RepoFILE) ){
663 case 0: { /* doesn't exist */
664 fossil_free(zPath);
665
--- src/update.c
+++ src/update.c
@@ -654,11 +654,11 @@
654 char *zEmptyDirs = db_get("empty-dirs", 0);
655 if( zEmptyDirs!=0 ){
656 int i;
657 Glob *pGlob = glob_create(zEmptyDirs);
658
659 for(i=0; pGlob!=0 && i<pGlob->nPattern; i++){
660 const char *zDir = pGlob->azPattern[i];
661 char *zPath = mprintf("%s/%s", g.zLocalRoot, zDir);
662 switch( file_isdir(zPath, RepoFILE) ){
663 case 0: { /* doesn't exist */
664 fossil_free(zPath);
665

Keyboard Shortcuts

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