Fossil SCM
Improve the check for an invalid clone sequence number on sync traffic. [forum:6b7a20af09|Bug report 2026-11-25T19:51:05Z].
Commit
a74bafcdcc39ea978d1d2673a357cf242a6df55667536cba18a2e6dda2bef094
Parent
4081bf2e3c81e6d…
1 file changed
+2
-4
+2
-4
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1637,12 +1637,11 @@ | ||
| 1637 | 1637 | ){ |
| 1638 | 1638 | int seqno, max; |
| 1639 | 1639 | if( iVers>=3 ){ |
| 1640 | 1640 | cgi_set_content_type("application/x-fossil-uncompressed"); |
| 1641 | 1641 | } |
| 1642 | - blob_is_int(&xfer.aToken[2], &seqno); | |
| 1643 | - if( seqno<=0 ){ | |
| 1642 | + if( !blob_is_int(&xfer.aToken[2], &seqno) || seqno<=0 ){ | |
| 1644 | 1643 | xfer_fatal_error("invalid clone sequence number"); |
| 1645 | 1644 | db_rollback_transaction(); |
| 1646 | 1645 | return; |
| 1647 | 1646 | } |
| 1648 | 1647 | max = db_int(0, "SELECT max(rid) FROM blob"); |
| @@ -2885,12 +2884,11 @@ | ||
| 2885 | 2884 | ** in sequence. This card indicates the sequence number of the next |
| 2886 | 2885 | ** blob that needs to be sent. If N<=0 that indicates that all blobs |
| 2887 | 2886 | ** have been sent. |
| 2888 | 2887 | */ |
| 2889 | 2888 | 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) ){ | |
| 2892 | 2890 | xfer_fatal_error("invalid clone_seqno"); |
| 2893 | 2891 | return ++nErr; |
| 2894 | 2892 | } |
| 2895 | 2893 | }else |
| 2896 | 2894 | |
| 2897 | 2895 |
| --- 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 |