From patchwork Fri Jul 24 08:59:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 51405 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 4220420323 for ; Fri, 24 Jul 2015 08:59:34 +0000 (UTC) Received: by lafd3 with SMTP id d3sf5384810laf.1 for ; Fri, 24 Jul 2015 01:59:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=lrN/zGwlZwx15edMdU9YiIwXrjGeuymSESeCkf5f+60=; b=UUfKq180j67GaF5BDY8gMsBBYQPvsI9DIAW/EcKcBLf6SIRE9dT5tQIy7kMKWiMxz0 M6SpGzBq4p8ZXzdteTpyGWerD+Zky585ShGXZdFuSYYok0g2fP/vfnWPp8Q0iE6gyFEw MUpTiMkMyuyhTSKqufgOI/KszF28BtwDqkg9G/ITAAOyqVv96cqLDMDpglT6CLK2sXGd cLxSelvrzJgXiayNczKoGEo/HmJhj0Rsmtk2IxvMJwTh0+S9TOVuwxec5IGexUPG6lP4 ZMp6ZZBaRZlt3+C2HgWqS09Mct2DXsMN2N7W5pYpLsXKAkbaEgD3TVUtBqlt5Ut55aNe /2aQ== X-Gm-Message-State: ALoCoQmkx9dAXKSI9RE1QVuGQv7OQmghqxaXsm4n529ySj4iGQS6WIN0qJvVuv5gfZhU1yd/8/WV X-Received: by 10.112.181.37 with SMTP id dt5mr5794375lbc.10.1437728372562; Fri, 24 Jul 2015 01:59:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.25.134 with SMTP id c6ls352586lag.54.gmail; Fri, 24 Jul 2015 01:59:32 -0700 (PDT) X-Received: by 10.113.4.105 with SMTP id cd9mr12639527lbd.106.1437728372412; Fri, 24 Jul 2015 01:59:32 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id mq4si6962325lbb.11.2015.07.24.01.59.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 01:59:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lblf12 with SMTP id f12so10980368lbl.2 for ; Fri, 24 Jul 2015 01:59:32 -0700 (PDT) X-Received: by 10.152.203.134 with SMTP id kq6mr12637567lac.106.1437728372275; Fri, 24 Jul 2015 01:59:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1027583lba; Fri, 24 Jul 2015 01:59:31 -0700 (PDT) X-Received: by 10.140.34.135 with SMTP id l7mr18299381qgl.79.1437728370886; Fri, 24 Jul 2015 01:59:30 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 139si9246391qhh.63.2015.07.24.01.59.29; Fri, 24 Jul 2015 01:59:30 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id C379261B4F; Fri, 24 Jul 2015 08:59:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 39E7661B18; Fri, 24 Jul 2015 08:59:25 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8592861B1C; Fri, 24 Jul 2015 08:59:23 +0000 (UTC) Received: from mail-ig0-f174.google.com (mail-ig0-f174.google.com [209.85.213.174]) by lists.linaro.org (Postfix) with ESMTPS id D8C6F61A7D for ; Fri, 24 Jul 2015 08:59:21 +0000 (UTC) Received: by igbpg9 with SMTP id pg9so11648576igb.0 for ; Fri, 24 Jul 2015 01:59:21 -0700 (PDT) X-Received: by 10.50.225.35 with SMTP id rh3mr4079687igc.29.1437728361530; Fri, 24 Jul 2015 01:59:21 -0700 (PDT) Received: from bala-Vostro-2520.caveonetworks.com ([111.93.218.67]) by smtp.gmail.com with ESMTPSA id q187sm4781981ioe.37.2015.07.24.01.59.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Jul 2015 01:59:21 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 24 Jul 2015 14:29:11 +0530 Message-Id: <1437728351-17811-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH] example: classifier: fix string overflow X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bala.manoharan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Bala Manoharan Fixes: https://bugs.linaro.org/show_bug.cgi?id=1512 Signed-off-by: Balasubramanian Manoharan Reviewed-by: Bill Fischofer --- example/classifier/odp_classifier.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 4f741d0..030eb8b 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -605,10 +605,10 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg) switch (term) { case ODP_PMR_SIP_ADDR: token = strtok(NULL, ":"); - strcpy(stats[policy_count].value, token); + strncpy(stats[policy_count].value, token, DISPLAY_STRING_LEN); parse_ipv4_addr(token, &stats[policy_count].rule.val); token = strtok(NULL, ":"); - strcpy(stats[policy_count].mask, token); + strncpy(stats[policy_count].mask, token, DISPLAY_STRING_LEN); parse_ipv4_mask(token, &stats[policy_count].rule.mask); stats[policy_count].val_sz = 4; break; @@ -619,7 +619,8 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg) /* Queue Name */ token = strtok(NULL, ":"); - strcpy(stats[policy_count].queue_name, token); + + strncpy(stats[policy_count].queue_name, token, ODP_QUEUE_NAME_LEN); appl_args->policy_count++; free(pmr_str); return 0;