Fossil SCM
Resolve null-pointer deref when reading an empty .fossil-settings/empty-dirs, reported in [forum:9ff6a143fc | forum post 9ff6a143fc].
Commit
b1dc25e1fe327f09f29eba00ccf8033a6953f11d34573de9bf96f6be1d6ac470
Parent
edd08ef4f8b5e4c…
1 file changed
+1
-1
+1
-1
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -654,11 +654,11 @@ | ||
| 654 | 654 | char *zEmptyDirs = db_get("empty-dirs", 0); |
| 655 | 655 | if( zEmptyDirs!=0 ){ |
| 656 | 656 | int i; |
| 657 | 657 | Glob *pGlob = glob_create(zEmptyDirs); |
| 658 | 658 | |
| 659 | - for(i=0; i<pGlob->nPattern; i++){ | |
| 659 | + for(i=0; pGlob!=0 && i<pGlob->nPattern; i++){ | |
| 660 | 660 | const char *zDir = pGlob->azPattern[i]; |
| 661 | 661 | char *zPath = mprintf("%s/%s", g.zLocalRoot, zDir); |
| 662 | 662 | switch( file_isdir(zPath, RepoFILE) ){ |
| 663 | 663 | case 0: { /* doesn't exist */ |
| 664 | 664 | fossil_free(zPath); |
| 665 | 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; 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 |