🏡 index : ~doyle/rgit.git

author holly sparkles <sparkles@holly.sh> 2024-01-15 13:01:26.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2024-01-15 12:26:47.0 +00:00:00
commit
912b88e6062de61c50cdbc6754b5e59d157a5882 [patch]
tree
612daf95a84f0213d55b1cc35b1271e3d043e33d
parent
584eadfa6b9f96b23745a45fed48421c1694a267
download
912b88e6062de61c50cdbc6754b5e59d157a5882.tar.gz

Fix for buffer overflow in fetch_latest_one

Signed-off-by: Jordan Doyle <jordan@doyle.la>

Diff

 src/database/schema/commit.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/database/schema/commit.rs b/src/database/schema/commit.rs
index 7454113..4c60a2e 100644
--- a/src/database/schema/commit.rs
+++ a/src/database/schema/commit.rs
@@ -189,7 +189,7 @@

    pub fn fetch_latest_one(&self) -> Result<Option<YokedCommit>, anyhow::Error> {
        let mut key = self.prefix.to_vec();
        key.extend_from_slice(&(self.len()? - 1).to_be_bytes());
        key.extend_from_slice(&(self.len()?.saturating_sub(1)).to_be_bytes());

        let cf = self
            .db