2014-07-26 14:03:15

by Rickard Strandqvist

[permalink] [raw]
Subject: [PATCH] arch: tile: kernel: setup.c: Cleaning up missing null-terminate in conjunction with strncpy

Replacing strncpy with strlcpy to avoid strings that lacks null terminate.

Signed-off-by: Rickard Strandqvist <[email protected]>
---
arch/tile/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index 112abab..1af7d19 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -1087,7 +1087,7 @@ static int __init setup_initramfs_file(char *str)
{
if (str == NULL)
return -EINVAL;
- strncpy(initramfs_file, str, sizeof(initramfs_file) - 1);
+ strlcpy(initramfs_file, str, sizeof(initramfs_file));
set_initramfs_file = 1;

return 0;
--
1.7.10.4