media: dvb_vb2: use strlcpy instead of strncpy
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 29 Dec 2017 12:53:30 +0000 (07:53 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 29 Dec 2017 12:53:30 +0000 (07:53 -0500)
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 <mchehab@s-opensource.com>
drivers/media/dvb-core/dvb_vb2.c

index 61c6ca4e87d5fe6ca657bcf10a276ae8b783a40a..889abf9becd848de9beb8c15f55fd86c25257f10 100644 (file)
@@ -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;