Fix null characters in BitmapCodecInfo strings

This commit is contained in:
pohky 2026-01-30 14:51:29 +01:00 committed by GitHub
parent 2b51a2a54e
commit 73edaadbca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -50,6 +50,6 @@ internal sealed class BitmapCodecInfo : IBitmapCodecInfo
_ = readFuncPtr(codecInfo, 0, null, &cch);
var buf = stackalloc char[(int)cch + 1];
Marshal.ThrowExceptionForHR(readFuncPtr(codecInfo, cch + 1, buf, &cch));
return new(buf, 0, (int)cch);
return new string(buf, 0, (int)cch).Trim('\0');
}
}