Update "SetStringKeepTerminatorStyle" to resolve "?" OT bug. (#3778)

This commit is contained in:
Zazsona 2023-02-12 19:28:51 +00:00 committed by GitHub
parent 92b841881d
commit 386c7078db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,10 +107,7 @@ public abstract class GBPKML : GBPKM
{
// Reset the destination buffer based on the termination style of the existing string.
bool zeroed = exist.IndexOf((byte)0) != -1;
byte fill = zeroed ? (byte)0 : StringConverter12.G1TerminatorCode;
exist.Fill(fill);
int finalLength = Math.Min(value.Length + 1, exist.Length);
SetString(value, exist, finalLength);
StringConverterOption converterOption = (zeroed) ? StringConverterOption.ClearZero : StringConverterOption.Clear50;
SetString(value, exist, value.Length, converterOption);
}
}