Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C93F7D76B for ; Wed, 12 Sep 2012 06:43:41 +0000 (UTC) Received: (qmail 812 invoked by uid 500); 12 Sep 2012 06:43:36 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 300 invoked by uid 500); 12 Sep 2012 06:43:35 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 98907 invoked by uid 99); 12 Sep 2012 06:43:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Sep 2012 06:43:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3ED2A35C08; Wed, 12 Sep 2012 06:43:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: edison@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [8/41] git commit: CS-14796: Error out with InvalidParameterValueException in UserVmManagerImpl if userdata is not base64 encoded. Message-Id: <20120912064329.3ED2A35C08@tyr.zones.apache.org> Date: Wed, 12 Sep 2012 06:43:29 +0000 (UTC) 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/4.0 Commit: cc80d09d77455d79d67ec5875283b37158af130d Parents: bfcc31d Author: Likitha Shetty Authored: Tue Sep 11 16:57:07 2012 -0700 Committer: Prachi Damle 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"); }