Skip to content

Commit

Permalink
Merge pull request #29 from AzCiS/onesdk-avirupch
Browse files Browse the repository at this point in the history
Fix for Bug 2142619
  • Loading branch information
parvezah committed Mar 25, 2015
2 parents 3bd1fc6 + e7b9bed commit 6acc061
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public override void ExecuteCmdlet()
return;
}

if(EncryptionEnabled == true && string.IsNullOrEmpty(EncryptionKey))
if(EncryptionEnabled == true && (string.IsNullOrEmpty(EncryptionKey) || !IsValidAsciiString(EncryptionKey)))
{
throw new ArgumentNullException("EncryptionKey");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using System.Net;
using System.Management.Automation;
using Microsoft.WindowsAzure.Commands.StorSimple.Models;
using System.Text.RegularExpressions;

namespace Microsoft.WindowsAzure.Commands.StorSimple
{
Expand Down Expand Up @@ -512,5 +513,10 @@ internal bool ValidTargetDeviceForFailover(string sourceDeviceId, string targetD

return true;
}

internal bool IsValidAsciiString(string s)
{
return Regex.IsMatch(s, "[ -~]+");
}
}
}

0 comments on commit 6acc061

Please sign in to comment.