From patchwork Mon Feb 16 15:27:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 44719 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0301F21544 for ; Mon, 16 Feb 2015 15:27:41 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id k11sf19912658wes.3 for ; Mon, 16 Feb 2015 07:27:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state: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=GxiiaV4xb1OjMbXyII94RC/PE1PSb5Za0YlIE7Y0pck=; b=G4Kek8dkmZlZcfSRM9oLIY/McZqStZrMMMx1YgD6nyxB6UUwGL8oinfLZ8N90ANAeN tbRO8HxJjZXTkw5SKBhWw4beLrPsIdk4GOBhjpR3OElRYXgIWXr0BT/Z3WnH/+Dx6bdK 167F5xrAFpqnEa4ZxhJuqGL0jP0YPjbJgn94TidJaWtxVuz4gOj/+7c/8koUkdkO3XPp xA6XNSOzPmvOAmGwXTgzx29CycdPELBP0igCaW2AE0mA9rjHlr175CFgOblUh4Qm4Qjx fwpS93r3dQmQZqe9ir+c+IvmTjb6lfh/4elGXhVL9fO52jjqCryOtY2SNvRq/VzF0bLq tRyw== X-Gm-Message-State: ALoCoQlTLMpJYp4RPo0l/NFBLUz3X+ydvncR7NpmMxijw33pVKo3BFJyWSSMrbZ9lvRz6StUwn+r X-Received: by 10.180.94.134 with SMTP id dc6mr2915706wib.2.1424100460301; Mon, 16 Feb 2015 07:27:40 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.171 with SMTP id kr11ls275527lac.36.gmail; Mon, 16 Feb 2015 07:27:40 -0800 (PST) X-Received: by 10.152.6.195 with SMTP id d3mr23266937laa.36.1424100460138; Mon, 16 Feb 2015 07:27:40 -0800 (PST) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id ec7si8392279lbc.32.2015.02.16.07.27.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Feb 2015 07:27:40 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by labms9 with SMTP id ms9so23739859lab.10 for ; Mon, 16 Feb 2015 07:27:40 -0800 (PST) X-Received: by 10.152.88.4 with SMTP id bc4mr23438618lab.86.1424100459993; Mon, 16 Feb 2015 07:27:39 -0800 (PST) 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.35.133 with SMTP id h5csp1649694lbj; Mon, 16 Feb 2015 07:27:39 -0800 (PST) X-Received: by 10.229.71.69 with SMTP id g5mr1548239qcj.7.1424100458607; Mon, 16 Feb 2015 07:27:38 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id o40si11135446qga.102.2015.02.16.07.27.37 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Feb 2015 07:27:38 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YNNaA-00043I-Cn; Mon, 16 Feb 2015 15:27:34 +0000 Received: from mail-la0-f52.google.com ([209.85.215.52]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YNNa4-00043D-Jy for lng-odp@lists.linaro.org; Mon, 16 Feb 2015 15:27:28 +0000 Received: by lams18 with SMTP id s18so29713259lam.13 for ; Mon, 16 Feb 2015 07:27:23 -0800 (PST) X-Received: by 10.112.138.233 with SMTP id qt9mr23315688lbb.44.1424100442964; Mon, 16 Feb 2015 07:27:22 -0800 (PST) Received: from localhost.localdomain (broadband-46-188-125-106.2com.net. [46.188.125.106]) by mx.google.com with ESMTPSA id te7sm3007200lbb.3.2015.02.16.07.27.21 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Feb 2015 07:27:22 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 16 Feb 2015 18:27:15 +0300 Message-Id: <1424100435-21015-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 X-Topics: patch Subject: [lng-odp] [PATCH] linux-generic: setup_pktio_entry() null terminate pkio name X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@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.215.45 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 Pktio code uses snprintf instead of strncpy for name copying. https://bugs.linaro.org/show_bug.cgi?id=1055 CID 85426: Buffer not null terminated (BUFFER_SIZE_WARNING) Calling strncpy with a maximum size argument of 16 bytes on destination array "pktio_entry->s.name" of size 16 bytes might leave the destination string unterminated. Signed-off-by: Maxim Uvarov Reviewed-by: Mike Holmes --- platform/linux-generic/odp_packet_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 559b230..c5d0569 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -251,7 +251,7 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool) id = ODP_PKTIO_INVALID; ODP_ERR("Unable to init any I/O type.\n"); } else { - strncpy(pktio_entry->s.name, dev, IFNAMSIZ); + snprintf(pktio_entry->s.name, IFNAMSIZ, "%s", dev); unlock_entry_classifier(pktio_entry); }