Fossil SCM

Fix dereferencing of NULL-pointer in 'pWiki' for the case when non-existent wiki page is requested.

george 2021-04-10 04:30 th1-doc-vars
Commit 735a7051f095ca930c276aa6d75ef8f64ec058ff3f9761effee2055261901111
1 file changed +6 -5
+6 -5
--- src/wiki.c
+++ src/wiki.c
@@ -599,16 +599,17 @@
599599
style_submenu_element("History", "%R/whistory?name=%T", zPageName);
600600
style_submenu_parametric("wiki",7);
601601
}
602602
}
603603
if( !isPopup ){
604
- char *zDate = db_text(0,"SELECT strftime('%%Y-%%m-%%d %%H:%%M',"
605
- "'%.17g',toLocal())",pWiki->rDate);
606
- Th_Store("wiki_timestamp",zDate);
607
- fossil_free( zDate );
608
- Th_Store("wiki_editor",pWiki->zUser);
609604
if( zHashsum ){
605
+ char *zDate = db_text(0,"SELECT strftime('%%Y-%%m-%%d %%H:%%M',"
606
+ "'%.17g',toLocal())",pWiki->rDate);
607
+ Th_Store("wiki_timestamp",zDate);
608
+ fossil_free( zDate );
609
+ Th_Store("wiki_editor",pWiki->zUser);
610
+
610611
Th_Store("artifact_hashsum",zHashsum);
611612
Th_Store("wiki_hashsum",zHashsum);
612613
fossil_free( (char*)zHashsum );
613614
}
614615
style_set_current_page("%T?name=%T", g.zPath, zPageName);
615616
--- src/wiki.c
+++ src/wiki.c
@@ -599,16 +599,17 @@
599 style_submenu_element("History", "%R/whistory?name=%T", zPageName);
600 style_submenu_parametric("wiki",7);
601 }
602 }
603 if( !isPopup ){
604 char *zDate = db_text(0,"SELECT strftime('%%Y-%%m-%%d %%H:%%M',"
605 "'%.17g',toLocal())",pWiki->rDate);
606 Th_Store("wiki_timestamp",zDate);
607 fossil_free( zDate );
608 Th_Store("wiki_editor",pWiki->zUser);
609 if( zHashsum ){
 
 
 
 
 
 
610 Th_Store("artifact_hashsum",zHashsum);
611 Th_Store("wiki_hashsum",zHashsum);
612 fossil_free( (char*)zHashsum );
613 }
614 style_set_current_page("%T?name=%T", g.zPath, zPageName);
615
--- src/wiki.c
+++ src/wiki.c
@@ -599,16 +599,17 @@
599 style_submenu_element("History", "%R/whistory?name=%T", zPageName);
600 style_submenu_parametric("wiki",7);
601 }
602 }
603 if( !isPopup ){
 
 
 
 
 
604 if( zHashsum ){
605 char *zDate = db_text(0,"SELECT strftime('%%Y-%%m-%%d %%H:%%M',"
606 "'%.17g',toLocal())",pWiki->rDate);
607 Th_Store("wiki_timestamp",zDate);
608 fossil_free( zDate );
609 Th_Store("wiki_editor",pWiki->zUser);
610
611 Th_Store("artifact_hashsum",zHashsum);
612 Th_Store("wiki_hashsum",zHashsum);
613 fossil_free( (char*)zHashsum );
614 }
615 style_set_current_page("%T?name=%T", g.zPath, zPageName);
616

Keyboard Shortcuts

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