Added a guaranteed null-terminate after call to strncpy.

Signed-off-by: Rickard Strandqvist <rickard_strandqv...@spectrumdigital.se>
---
 drivers/misc/c2port/core.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
index 464419b..62b0baa 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
@@ -933,6 +933,7 @@ struct c2port_device *c2port_device_register(char *name,
        dev_set_drvdata(c2dev->dev, c2dev);
 
        strncpy(c2dev->name, name, C2PORT_NAME_LEN);
+       c2dev->name[C2PORT_NAME_LEN - 1] = '\0';
        c2dev->ops = ops;
        mutex_init(&c2dev->mutex);
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to