From 4bc03b6bfa56e0a0644fbbd9c54c1094bf58c4c1 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Fri, 30 Oct 2020 09:53:46 +0100 Subject: [PATCH] Fixing value overflow for Convert-Bytes --- doc/31-Changelog.md | 1 + lib/core/tools/Convert-Bytes.psm1 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index 844b3e8..a1b895c 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -22,6 +22,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic * [#127](https://github.com/Icinga/icinga-powershell-framework/issues/127) Fixes wrong error message on failed MSSQL connection due to database not reachable by using `-IntegratedSecurity` * [#128](https://github.com/Icinga/icinga-powershell-framework/issues/128) Fixes unhandled output from loading `System.Reflection.Assembly` which can cause weird side effects for plugin outputs * [#130](https://github.com/Icinga/icinga-powershell-framework/issues/130) Fix crash while running services as background task to collect metrics over time by missing Performance Counter cache initialisation +* [#138](https://github.com/Icinga/icinga-powershell-framework/issues/138) Fixes possible value overflow on `Convert-Bytes` while converting from anything larger than MB to Bytes ## 1.2.0 (2020-08-28) diff --git a/lib/core/tools/Convert-Bytes.psm1 b/lib/core/tools/Convert-Bytes.psm1 index 1dd4cad..870a9b8 100644 --- a/lib/core/tools/Convert-Bytes.psm1 +++ b/lib/core/tools/Convert-Bytes.psm1 @@ -33,7 +33,7 @@ function Convert-Bytes() } } } - return @{'value' = $FinalValue; 'pastunit' = $CurrentUnit; 'endunit' = $Unit }; + return @{'value' = ([decimal]$FinalValue); 'pastunit' = $CurrentUnit; 'endunit' = $Unit }; } Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;