From: Martin Wilck Subject: [PATCH 3/8] libmultipath, alloc_path_with_pathinfo(): Ensure that pp->wwid is '\0'-terminated Date: Thu, 8 Mar 2018 00:15:46 +0100 Message-ID: <20180307231551.15162-4-mwilck@suse.com> References: <20180307231551.15162-1-mwilck@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180307231551.15162-1-mwilck@suse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Christophe Varoqui Cc: Bart Van Assche , Bart Van Assche , dm-devel@redhat.com, Martin Wilck , Chongyun Wu List-Id: dm-devel.ids From: Bart Van Assche Discovered by Coverity (CID 173257). Signed-off-by: Bart Van Assche Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 9efcaac81dc1..71c75872c937 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -53,8 +53,8 @@ alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice, if (!pp) return PATHINFO_FAILED; - if(wwid) - strncpy(pp->wwid, wwid, sizeof(pp->wwid)); + if (wwid) + strlcpy(pp->wwid, wwid, sizeof(pp->wwid)); if (safe_sprintf(pp->dev, "%s", devname)) { condlog(0, "pp->dev too small"); -- 2.16.1