From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id B9E9C1B293 for ; Mon, 6 Aug 2018 20:11:20 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id j8-v6so7246918pff.6 for ; Mon, 06 Aug 2018 11:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lBUECSWqx3BIgUUyg5d7VkYSdQ2BDwHmGQR4DhdxbHU=; b=c0/ntOKnBFzaPyYWYTsrp29B+B0dal9HAxdo/cxA+DQSZYV/Chaslt5gjZqWrm9UAs CcfiHqYnmMYBzTyIsa7YEMvcuWXetNwv8vuVHO+MkSBOsndec8TQJliQNKX2lKMLq4od +3Ya5Ch1Ku10sZIkoECFlkzNqE4WzKMo4xY/gc1F+VA4grO5Pg8jXbnLX/8QfselAxHg IQxKyIxw0UAQ+9manflVVfbjevxu6XlDNyZOFiKHIWfosqmqzp6oZllP2LZp1/nngzTC +wTKFvmSnJP1MD8IKZZz+xkRDZuMgDg+VxZIZgVl0O+DQzPGI2d00kTFbhwc6wt29qxD Hfww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lBUECSWqx3BIgUUyg5d7VkYSdQ2BDwHmGQR4DhdxbHU=; b=Ttpm/c7i5EqzdNySh5grEEskyCuhUwiswnNQ5vfqP3P7IPIwdJj+fNOLh+Y24l2j9Q aFMF7mvt8loomkqPRSxH/NlMpGfHmdKDaJZo2d6mXl5d97KU13jGQHYZyYvqLn04z9YM P/Ofwzof1JZQ928Qnj/x9v5a6/KbXfaDJvMvD43YbRE7NvY4QATWhvV5qyE6h0VIuGrR sHjm6inLvSdImLPt5NKx2H9c+ahvE4uXBF+sUUKNck2hWTkztRJJkttVPqKAD6z5DArz IU6C6CJpCENuB202I66PqrDWYc0qnxUARk3iWNA1/wlZ62VfTmTVWw4sZXypyB3JRU85 NgJA== X-Gm-Message-State: AOUpUlGjbvhVKBHs926gdE19PeUzSfESJXMyZHzrLp/VkO4b9BGR6xUG f5WQwWoMau2yGL4wkUzAtqOoXX5/c2c= X-Google-Smtp-Source: AAOMgpeYpIInZ2bSs44BwXFzuEGvKnO+WkGMv1HtmTepRiaLzx1iSHfLZ4I/bUpIqbFrbFBlf9iCZw== X-Received: by 2002:a63:fe02:: with SMTP id p2-v6mr15556233pgh.148.1533579079510; Mon, 06 Aug 2018 11:11:19 -0700 (PDT) Received: from xeon-e3.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id q78-v6sm23388130pfi.185.2018.08.06.11.11.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 11:11:18 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Mon, 6 Aug 2018 11:11:07 -0700 Message-Id: <20180806181108.5913-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180806181108.5913-1-stephen@networkplumber.org> References: <20180806181108.5913-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 2/3] vmbus: make sure path is null terminated X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2018 18:11:21 -0000 Use strlcpy rather than strncpy to avoid any issues about null termination. Coverity issue 302859 Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Signed-off-by: Stephen Hemminger --- drivers/bus/vmbus/linux/vmbus_uio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index 0b1b153cc017..bc2c6235e6bc 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "private.h" @@ -89,7 +90,7 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev, goto error; } - strncpy((*uio_res)->path, devname, PATH_MAX); + strlcpy((*uio_res)->path, devname, PATH_MAX); rte_uuid_copy((*uio_res)->id, dev->device_id); return 0; -- 2.18.0