[Core] Fix File.get_buffer returning wrong length
File.get_buffer always returned as many bytes as requested (even when EOF was reached), this resulted in random bytes being returned when overflowing.
This commit is contained in:
parent
8fb47d6b3e
commit
d8ea68d3dd
1 changed files with 1 additions and 1 deletions
|
@ -2177,7 +2177,7 @@ PoolVector<uint8_t> _File::get_buffer(int64_t p_length) const {
|
||||||
w.release();
|
w.release();
|
||||||
|
|
||||||
if (len < p_length) {
|
if (len < p_length) {
|
||||||
data.resize(p_length);
|
data.resize(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
Loading…
Reference in a new issue