From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bart Van Assche Subject: [PATCH 2/6] libmultipath, alloc_path_with_pathinfo(): Ensure that pp->wwid is '\0'-terminated Date: Thu, 1 Mar 2018 11:29:31 -0800 Message-ID: <20180301192935.14643-3-bart.vanassche@wdc.com> References: <20180301192935.14643-1-bart.vanassche@wdc.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180301192935.14643-1-bart.vanassche@wdc.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 , dm-devel@redhat.com List-Id: dm-devel.ids Discovered by Coverity (CID 173257). Signed-off-by: Bart Van Assche --- libmultipath/discovery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 4b31ddef23f0..fe50ce5062ea 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -52,8 +52,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.2