Fossil SCM

Fix NULL pointer dereference introduced by check-in [b05a6c6bc826d3c2]. Fix for the problem reported by [forum:/forumpost/bfb99db2886ca3b5|forum post/bfb99db2886ca3b5].

drh 2022-05-11 11:08 trunk
Commit c68fa2edd76d9008b49d58170f565e99ec6b2f9c219330052fa003d092f613fa
1 file changed +5 -3
+5 -3
--- src/style.c
+++ src/style.c
@@ -770,13 +770,15 @@
770770
Th_Store("home", g.zTop);
771771
Th_Store("index_page", db_get("index-page","/home"));
772772
if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath);
773773
Th_Store("current_page", local_zCurrentPage);
774774
/* store the first segment of a path; make a temporary cut if necessary */
775
- if(( zSlash = strchr(g.zPath,'/') )) *zSlash = 0;
776
- Th_Store("requested_page", escape_quotes(g.zPath));
777
- if( zSlash ) *zSlash = '/';
775
+ if( g.zPath && (zSlash = strchr(g.zPath,'/'))!=0 ){
776
+ *zSlash = 0;
777
+ Th_Store("requested_page", escape_quotes(g.zPath));
778
+ *zSlash = '/';
779
+ }
778780
Th_Store("canonical_page", escape_quotes(g.zPhase+1));
779781
Th_Store("csrf_token", g.zCsrfToken);
780782
Th_Store("release_version", RELEASE_VERSION);
781783
Th_Store("manifest_version", MANIFEST_VERSION);
782784
Th_Store("manifest_date", MANIFEST_DATE);
783785
--- src/style.c
+++ src/style.c
@@ -770,13 +770,15 @@
770 Th_Store("home", g.zTop);
771 Th_Store("index_page", db_get("index-page","/home"));
772 if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath);
773 Th_Store("current_page", local_zCurrentPage);
774 /* store the first segment of a path; make a temporary cut if necessary */
775 if(( zSlash = strchr(g.zPath,'/') )) *zSlash = 0;
776 Th_Store("requested_page", escape_quotes(g.zPath));
777 if( zSlash ) *zSlash = '/';
 
 
778 Th_Store("canonical_page", escape_quotes(g.zPhase+1));
779 Th_Store("csrf_token", g.zCsrfToken);
780 Th_Store("release_version", RELEASE_VERSION);
781 Th_Store("manifest_version", MANIFEST_VERSION);
782 Th_Store("manifest_date", MANIFEST_DATE);
783
--- src/style.c
+++ src/style.c
@@ -770,13 +770,15 @@
770 Th_Store("home", g.zTop);
771 Th_Store("index_page", db_get("index-page","/home"));
772 if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath);
773 Th_Store("current_page", local_zCurrentPage);
774 /* store the first segment of a path; make a temporary cut if necessary */
775 if( g.zPath && (zSlash = strchr(g.zPath,'/'))!=0 ){
776 *zSlash = 0;
777 Th_Store("requested_page", escape_quotes(g.zPath));
778 *zSlash = '/';
779 }
780 Th_Store("canonical_page", escape_quotes(g.zPhase+1));
781 Th_Store("csrf_token", g.zCsrfToken);
782 Th_Store("release_version", RELEASE_VERSION);
783 Th_Store("manifest_version", MANIFEST_VERSION);
784 Th_Store("manifest_date", MANIFEST_DATE);
785

Keyboard Shortcuts

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