mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Avoid buffer overflows when the sandboxee shrinks a shared buffer.
PiperOrigin-RevId: 355336078 Change-Id: I36aa106b3044cbc20b30718a12bd35d147c339c6
This commit is contained in:
parent
0bbcb495ee
commit
637dc471ac
|
@ -113,7 +113,7 @@ class Array : public Var, public Pointable {
|
||||||
} else {
|
} else {
|
||||||
new_addr = malloc(size);
|
new_addr = malloc(size);
|
||||||
if (new_addr) {
|
if (new_addr) {
|
||||||
memcpy(new_addr, arr_, total_size_);
|
memcpy(new_addr, arr_, std::min(size, total_size_));
|
||||||
buffer_owned_ = true;
|
buffer_owned_ = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user