diff options
| author | Bond_009 <bond.009@outlook.com> | 2026-06-16 17:54:23 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2026-06-16 17:54:23 +0200 |
| commit | e86b502cbc9d48c876cc125f3c316171c1113926 (patch) | |
| tree | a5f0f04e22831dc11562b1025bbe33215813478e /MediaBrowser.MediaEncoding | |
| parent | 4c228eaf63c0b60e40a5a4b82aa66af336750f08 (diff) | |
Strip null-terminator
Diffstat (limited to 'MediaBrowser.MediaEncoding')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs b/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs index 8cae6a238d..baea0df8cc 100644 --- a/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs +++ b/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs @@ -37,7 +37,12 @@ public static partial class ApplePlatformHelper throw new NotSupportedException($"Failed to get sysctl value for {name} with error {osStatus}"); } - ReadOnlySpan<byte> data = buffer.AsSpan()[..(int)length]; + if (length < 1) + { + return string.Empty; + } + + ReadOnlySpan<byte> data = buffer.AsSpan()[..(int)(length - 1)]; return Encoding.UTF8.GetString(data); } finally |
