Updated Branches: refs/heads/master bfcc31d9e -> cc80d09d7
CS-14796: Error out with InvalidParameterValueException in UserVmManagerImpl if userdata is not base64 encoded. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/cc80d09d Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/cc80d09d Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/cc80d09d Branch: refs/heads/master Commit: cc80d09d77455d79d67ec5875283b37158af130d Parents: bfcc31d Author: Likitha Shetty <likitha.she...@citrix.com> Authored: Tue Sep 11 16:57:07 2012 -0700 Committer: Prachi Damle <pra...@cloud.com> Committed: Tue Sep 11 16:58:09 2012 -0700 ---------------------------------------------------------------------- server/src/com/cloud/vm/UserVmManagerImpl.java | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/cc80d09d/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index a1241da..73a60ce 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -2558,6 +2558,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager private void validateUserData(String userData) { byte[] decodedUserData = null; if (userData != null) { + if (!Base64.isBase64(userData)) { + throw new InvalidParameterValueException("User data is not base64 encoded"); + } if (userData.length() >= 2 * MAX_USER_DATA_LENGTH_BYTES) { throw new InvalidParameterValueException("User data is too long"); }