Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 86884200CF3 for ; Wed, 13 Sep 2017 18:54:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8541E1609CA; Wed, 13 Sep 2017 16:54:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CC4971609C3 for ; Wed, 13 Sep 2017 18:54:33 +0200 (CEST) Received: (qmail 93247 invoked by uid 500); 13 Sep 2017 16:54:31 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 93238 invoked by uid 99); 13 Sep 2017 16:54:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Sep 2017 16:54:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C32A9F57A8; Wed, 13 Sep 2017 16:54:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: wangda@apache.org To: common-commits@hadoop.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: YARN-7014. Fix off-by-one error causing heap corruption (Jason Lowe via nroberts) Date: Wed, 13 Sep 2017 16:54:31 +0000 (UTC) archived-at: Wed, 13 Sep 2017 16:54:34 -0000 Repository: hadoop Updated Branches: refs/heads/branch-2 464776134 -> 1d33290a0 YARN-7014. Fix off-by-one error causing heap corruption (Jason Lowe via nroberts) (cherry picked from commit d265459024b8e5f5eccf421627f684ca8f162112) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1d33290a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1d33290a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1d33290a Branch: refs/heads/branch-2 Commit: 1d33290a0a25f3d431f6eca9717dbf2761cec176 Parents: 4647761 Author: Nathan Roberts Authored: Tue Aug 15 15:52:48 2017 -0500 Committer: Wangda Tan Committed: Wed Sep 13 09:47:55 2017 -0700 ---------------------------------------------------------------------- .../src/main/native/container-executor/impl/utils/string-utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1d33290a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/string-utils.c ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/string-utils.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/string-utils.c index 703d484..063df7e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/string-utils.c +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/string-utils.c @@ -44,8 +44,7 @@ int validate_container_id(const char* input) { * container_e17_1410901177871_0001_01_000005 * container_1410901177871_0001_01_000005 */ - char* input_cpy = malloc(strlen(input)); - strcpy(input_cpy, input); + char* input_cpy = strdup(input); char* p = strtok(input_cpy, "_"); int idx = 0; while (p != NULL) { --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org