The Free Software Media System - Server Backend & API
Strip null-terminator
Bond_009e86b502cbc9d
diff --git a/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs b/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.csindex 8cae6a238d..baea0df8cc 100644--- a/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs+++ b/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs@@ -37,7 +37,12 @@ public static partial class ApplePlatformHelperthrow 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