mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
std.crypto.tls.Client: fix @memcpy crash in limitedOverlapCopy
Resolves: #15928
This commit is contained in:
parent
028f2ed30f
commit
9e61ba19e9
@ -1256,10 +1256,8 @@ fn limitedOverlapCopy(frag: []u8, in: usize) void {
|
|||||||
// A single, non-overlapping memcpy suffices.
|
// A single, non-overlapping memcpy suffices.
|
||||||
@memcpy(frag[0..first.len], first);
|
@memcpy(frag[0..first.len], first);
|
||||||
} else {
|
} else {
|
||||||
// Need two memcpy calls because one alone would overlap.
|
// One memcpy call would overlap, so just do this instead.
|
||||||
@memcpy(frag[0..in], first[0..in]);
|
std.mem.copyForwards(u8, frag, first);
|
||||||
const leftover = first.len - in;
|
|
||||||
@memcpy(frag[in..][0..leftover], first[in..][0..leftover]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user