lib/nbt: Fix a possible buffer overflow in readString()
parent
ca7b121c4d
commit
a1fc0ce4b4
|
@ -154,6 +154,9 @@ namespace NBT {
|
|||
if (stringSize.isError) {
|
||||
return ErrorOr<tiny_utf8::string>(true, stringSize.errorCode);
|
||||
}
|
||||
if (currentPosition + (uint64_t) stringSize.value + 2 > dataSize) {
|
||||
return ErrorOr<tiny_utf8::string>(true, ErrorCodes::OVERRUN);
|
||||
}
|
||||
|
||||
ErrorOr<tiny_utf8::string> output = JavaCompat::importJavaString(data+currentPosition, stringSize.value);
|
||||
if(output.isError){
|
||||
|
|
Loading…
Reference in New Issue