Skip to content

Commit 6acc061

Browse files
committed
Merge pull request #29 from AzCiS/onesdk-avirupch
Fix for Bug 2142619
2 parents 3bd1fc6 + e7b9bed commit 6acc061

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DataContainer/NewAzureStorSimpleDeviceVolumeContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public override void ExecuteCmdlet()
6565
return;
6666
}
6767

68-
if(EncryptionEnabled == true && string.IsNullOrEmpty(EncryptionKey))
68+
if(EncryptionEnabled == true && (string.IsNullOrEmpty(EncryptionKey) || !IsValidAsciiString(EncryptionKey)))
6969
{
7070
throw new ArgumentNullException("EncryptionKey");
7171
}

src/ServiceManagement/StorSimple/Commands.StorSimple/StorSimpleCmdletBase.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using System.Net;
2626
using System.Management.Automation;
2727
using Microsoft.WindowsAzure.Commands.StorSimple.Models;
28+
using System.Text.RegularExpressions;
2829

2930
namespace Microsoft.WindowsAzure.Commands.StorSimple
3031
{
@@ -512,5 +513,10 @@ internal bool ValidTargetDeviceForFailover(string sourceDeviceId, string targetD
512513

513514
return true;
514515
}
516+
517+
internal bool IsValidAsciiString(string s)
518+
{
519+
return Regex.IsMatch(s, "[ -~]+");
520+
}
515521
}
516522
}

0 commit comments

Comments
 (0)