mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
WINTERMUTE: Don't crop UIEdit strings to negative sizes
If _maxLength was -1, we would end up with a 0-size allocation, and a write that starts right before it, which gives odd results.
This commit is contained in:
parent
b2dcd1bb1e
commit
1eca88cb39
@ -899,7 +899,7 @@ int UIEdit::deleteChars(int start, int end) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int UIEdit::insertChars(int pos, const byte *chars, int num) {
|
||||
if ((int)strlen(_text) + num > _maxLength) {
|
||||
if ((_maxLength != -1) && (int)strlen(_text) + num > _maxLength) {
|
||||
num -= (strlen(_text) + num - _maxLength);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user