Fossil SCM

Fixed [17d00c20dd9f] by adding NULL check on F- and E-card UUID tokens.

stephan 2020-08-17 17:50 reject-ckout-db
Commit 458f30fc0b36026af3a3652d7f3156bc10aace4bd7a75095b023a27b9ae00e0a
1 file changed +2
--- src/manifest.c
+++ src/manifest.c
@@ -610,10 +610,11 @@
610610
case 'E': {
611611
if( p->rEventDate>0.0 ) SYNTAX("more than one E-card");
612612
p->rEventDate = db_double(0.0,"SELECT julianday(%Q)", next_token(&x,0));
613613
if( p->rEventDate<=0.0 ) SYNTAX("malformed date on E-card");
614614
p->zEventId = next_token(&x, &sz);
615
+ if( p->zEventId==0 ) SYNTAX("missing hash on E-card");
615616
if( !hname_validate(p->zEventId, sz) ){
616617
SYNTAX("malformed hash on E-card");
617618
}
618619
p->type = CFTYPE_EVENT;
619620
break;
@@ -636,10 +637,11 @@
636637
}else if( filename_is_ckout_db(zName,-1) ){
637638
SYNTAX("F-card contains reserved name of a checkout db.");
638639
}
639640
zUuid = next_token(&x, &sz);
640641
if( p->zBaseline==0 || zUuid!=0 ){
642
+ if( zUuid==0 ) SYNTAX("missing hash on F-card");
641643
if( !hname_validate(zUuid,sz) ){
642644
SYNTAX("F-card hash invalid");
643645
}
644646
}
645647
zPerm = next_token(&x,0);
646648
--- src/manifest.c
+++ src/manifest.c
@@ -610,10 +610,11 @@
610 case 'E': {
611 if( p->rEventDate>0.0 ) SYNTAX("more than one E-card");
612 p->rEventDate = db_double(0.0,"SELECT julianday(%Q)", next_token(&x,0));
613 if( p->rEventDate<=0.0 ) SYNTAX("malformed date on E-card");
614 p->zEventId = next_token(&x, &sz);
 
615 if( !hname_validate(p->zEventId, sz) ){
616 SYNTAX("malformed hash on E-card");
617 }
618 p->type = CFTYPE_EVENT;
619 break;
@@ -636,10 +637,11 @@
636 }else if( filename_is_ckout_db(zName,-1) ){
637 SYNTAX("F-card contains reserved name of a checkout db.");
638 }
639 zUuid = next_token(&x, &sz);
640 if( p->zBaseline==0 || zUuid!=0 ){
 
641 if( !hname_validate(zUuid,sz) ){
642 SYNTAX("F-card hash invalid");
643 }
644 }
645 zPerm = next_token(&x,0);
646
--- src/manifest.c
+++ src/manifest.c
@@ -610,10 +610,11 @@
610 case 'E': {
611 if( p->rEventDate>0.0 ) SYNTAX("more than one E-card");
612 p->rEventDate = db_double(0.0,"SELECT julianday(%Q)", next_token(&x,0));
613 if( p->rEventDate<=0.0 ) SYNTAX("malformed date on E-card");
614 p->zEventId = next_token(&x, &sz);
615 if( p->zEventId==0 ) SYNTAX("missing hash on E-card");
616 if( !hname_validate(p->zEventId, sz) ){
617 SYNTAX("malformed hash on E-card");
618 }
619 p->type = CFTYPE_EVENT;
620 break;
@@ -636,10 +637,11 @@
637 }else if( filename_is_ckout_db(zName,-1) ){
638 SYNTAX("F-card contains reserved name of a checkout db.");
639 }
640 zUuid = next_token(&x, &sz);
641 if( p->zBaseline==0 || zUuid!=0 ){
642 if( zUuid==0 ) SYNTAX("missing hash on F-card");
643 if( !hname_validate(zUuid,sz) ){
644 SYNTAX("F-card hash invalid");
645 }
646 }
647 zPerm = next_token(&x,0);
648

Keyboard Shortcuts

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