Fossil SCM

Improve the check for an invalid clone sequence number on sync traffic. [forum:6b7a20af09|Bug report 2026-11-25T19:51:05Z].

stephan 2026-11-25 20:51 UTC trunk
Commit a74bafcdcc39ea978d1d2673a357cf242a6df55667536cba18a2e6dda2bef094
1 file changed +2 -4
+2 -4
--- src/xfer.c
+++ src/xfer.c
@@ -1637,12 +1637,11 @@
16371637
){
16381638
int seqno, max;
16391639
if( iVers>=3 ){
16401640
cgi_set_content_type("application/x-fossil-uncompressed");
16411641
}
1642
- blob_is_int(&xfer.aToken[2], &seqno);
1643
- if( seqno<=0 ){
1642
+ if( !blob_is_int(&xfer.aToken[2], &seqno) || seqno<=0 ){
16441643
xfer_fatal_error("invalid clone sequence number");
16451644
db_rollback_transaction();
16461645
return;
16471646
}
16481647
max = db_int(0, "SELECT max(rid) FROM blob");
@@ -2885,12 +2884,11 @@
28852884
** in sequence. This card indicates the sequence number of the next
28862885
** blob that needs to be sent. If N<=0 that indicates that all blobs
28872886
** have been sent.
28882887
*/
28892888
if( blob_eq(&xfer.aToken[0], "clone_seqno") && xfer.nToken==2 ){
2890
- blob_is_int(&xfer.aToken[1], &cloneSeqno);
2891
- if( cloneSeqno<0 ){
2889
+ if( !blob_is_int(&xfer.aToken[1], &cloneSeqno) ){
28922890
xfer_fatal_error("invalid clone_seqno");
28932891
return ++nErr;
28942892
}
28952893
}else
28962894
28972895
--- src/xfer.c
+++ src/xfer.c
@@ -1637,12 +1637,11 @@
1637 ){
1638 int seqno, max;
1639 if( iVers>=3 ){
1640 cgi_set_content_type("application/x-fossil-uncompressed");
1641 }
1642 blob_is_int(&xfer.aToken[2], &seqno);
1643 if( seqno<=0 ){
1644 xfer_fatal_error("invalid clone sequence number");
1645 db_rollback_transaction();
1646 return;
1647 }
1648 max = db_int(0, "SELECT max(rid) FROM blob");
@@ -2885,12 +2884,11 @@
2885 ** in sequence. This card indicates the sequence number of the next
2886 ** blob that needs to be sent. If N<=0 that indicates that all blobs
2887 ** have been sent.
2888 */
2889 if( blob_eq(&xfer.aToken[0], "clone_seqno") && xfer.nToken==2 ){
2890 blob_is_int(&xfer.aToken[1], &cloneSeqno);
2891 if( cloneSeqno<0 ){
2892 xfer_fatal_error("invalid clone_seqno");
2893 return ++nErr;
2894 }
2895 }else
2896
2897
--- src/xfer.c
+++ src/xfer.c
@@ -1637,12 +1637,11 @@
1637 ){
1638 int seqno, max;
1639 if( iVers>=3 ){
1640 cgi_set_content_type("application/x-fossil-uncompressed");
1641 }
1642 if( !blob_is_int(&xfer.aToken[2], &seqno) || seqno<=0 ){
 
1643 xfer_fatal_error("invalid clone sequence number");
1644 db_rollback_transaction();
1645 return;
1646 }
1647 max = db_int(0, "SELECT max(rid) FROM blob");
@@ -2885,12 +2884,11 @@
2884 ** in sequence. This card indicates the sequence number of the next
2885 ** blob that needs to be sent. If N<=0 that indicates that all blobs
2886 ** have been sent.
2887 */
2888 if( blob_eq(&xfer.aToken[0], "clone_seqno") && xfer.nToken==2 ){
2889 if( !blob_is_int(&xfer.aToken[1], &cloneSeqno) ){
 
2890 xfer_fatal_error("invalid clone_seqno");
2891 return ++nErr;
2892 }
2893 }else
2894
2895

Keyboard Shortcuts

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