From patchwork Fri Dec 29 13:37:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10137123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70AAB60318 for ; Fri, 29 Dec 2017 13:38:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60F922CCA0 for ; Fri, 29 Dec 2017 13:38:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55D0E2DE58; Fri, 29 Dec 2017 13:38:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 191822CCA0 for ; Fri, 29 Dec 2017 13:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751105AbdL2NiG (ORCPT ); Fri, 29 Dec 2017 08:38:06 -0500 Received: from osg.samsung.com ([64.30.133.232]:54786 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750841AbdL2NiC (ORCPT ); Fri, 29 Dec 2017 08:38:02 -0500 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 9638B28DD6; Fri, 29 Dec 2017 05:38:02 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kkJXx341gqnC; Fri, 29 Dec 2017 05:38:01 -0800 (PST) Received: from smtp.s-opensource.com (179.176.121.132.dynamic.adsl.gvt.net.br [179.176.121.132]) by osg.samsung.com (Postfix) with ESMTPSA id DE37928DA5; Fri, 29 Dec 2017 05:37:59 -0800 (PST) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.89) (envelope-from ) id 1eUurF-0005z3-1U; Fri, 29 Dec 2017 08:37:57 -0500 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Inki Dae , Junghak Sung , Geunyoung Kim , Seung-Woo Kim , Satendra Singh Thakur Subject: [PATCH 1/4] media: dvb_vb2: use strlcpy instead of strncpy Date: Fri, 29 Dec 2017 08:37:53 -0500 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of using strncpy(), use strlcpy(), in order to ensure that a \0 char will be added at the end of the string. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/dvb_vb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_vb2.c b/drivers/media/dvb-core/dvb_vb2.c index 61c6ca4e87d5..889abf9becd8 100644 --- a/drivers/media/dvb-core/dvb_vb2.c +++ b/drivers/media/dvb-core/dvb_vb2.c @@ -194,7 +194,7 @@ int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name, int nonblocking) spin_lock_init(&ctx->slock); INIT_LIST_HEAD(&ctx->dvb_q); - strncpy(ctx->name, name, DVB_VB2_NAME_MAX); + strlcpy(ctx->name, name, DVB_VB2_NAME_MAX); ctx->nonblocking = nonblocking; ctx->state = DVB_VB2_STATE_INIT;