mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +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.
|
||||
@memcpy(frag[0..first.len], first);
|
||||
} else {
|
||||
// Need two memcpy calls because one alone would overlap.
|
||||
@memcpy(frag[0..in], first[0..in]);
|
||||
const leftover = first.len - in;
|
||||
@memcpy(frag[in..][0..leftover], first[in..][0..leftover]);
|
||||
// One memcpy call would overlap, so just do this instead.
|
||||
std.mem.copyForwards(u8, frag, first);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user