Skip to content

Commit 1b8fd85

Browse files
committed
Merge branch 'safe-cstring' into inet
2 parents c3efbcd + a011ca3 commit 1b8fd85

10 files changed

Lines changed: 895 additions & 1471 deletions

File tree

‎libcc2rs/src/rc.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,16 @@ thread_local! {
952952
impl Ptr<u8> {
953953
#[allow(clippy::explicit_counter_loop)]
954954
pub fn memcpy(&self, src: &Self, len: usize) {
955+
if *self > *src {
956+
let mut dst = self.offset(len);
957+
let mut s = src.offset(len);
958+
for _ in 0..len {
959+
dst -= 1;
960+
s -= 1;
961+
dst.write(s.read());
962+
}
963+
return;
964+
}
955965
let mut dst = self.clone();
956966
let mut i: usize = 0;
957967
for value in src {

0 commit comments

Comments
 (0)