From f8a6ba7695bdbfcf484175d2f92594d9c379f3ab Mon Sep 17 00:00:00 2001 From: UlrichBerntien Date: Sun, 27 Jan 2019 11:18:26 +0100 Subject: [PATCH] Fixed: using non-local variable. Bug was invisible because Invoke-PatchDll is called only once with $RawBytes as $DllBytes parameter --- data/module_source/management/Invoke-PSInject.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/module_source/management/Invoke-PSInject.ps1 b/data/module_source/management/Invoke-PSInject.ps1 index 26ab3a410..7d0ffe0c4 100644 --- a/data/module_source/management/Invoke-PSInject.ps1 +++ b/data/module_source/management/Invoke-PSInject.ps1 @@ -112,7 +112,7 @@ Param( write-verbose "replacestart: $replacestart" write-verbose "replaceend: $replaceend" - $NewCode=[System.Text.Encoding]::Unicode.GetString($RawBytes[$replacestart..$replaceend]) + $NewCode=[System.Text.Encoding]::Unicode.GetString($DllBytes[$replacestart..$replaceend]) write-verbose "Replaced pattern with: $NewCode" return $DllBytes