summaryrefslogtreecommitdiff
path: root/tests/checkfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-25 14:39:08 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-09 22:13:18 +0100
commitdcfd984d8e09db9d5a7b4d121d914442966c254f (patch)
treeb5807cd38c839423d8344596ddb77df6ce027b11 /tests/checkfs
parent83c675ac9aed767e4431a5bbc25f3ccd7f77cf84 (diff)
mtd-utils: Fix potentially unterminated strings
This commit fixes some uses of strncpy that could leave the destination buffer unterminated. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/checkfs')
-rw-r--r--tests/checkfs/checkfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/checkfs/checkfs.c b/tests/checkfs/checkfs.c
index 3e34cc4..203ad5c 100644
--- a/tests/checkfs/checkfs.c
+++ b/tests/checkfs/checkfs.c
@@ -512,7 +512,8 @@ static void processCmdLine(int argc, char **argv)
{
if(strcmp(argv[cnt], CMDLINE_PORT) == 0)
{
- strncpy(SerialDevice, argv[++cnt], sizeof(SerialDevice));
+ strncpy(SerialDevice, argv[++cnt], sizeof(SerialDevice) - 1);
+ SerialDevice[sizeof(SerialDevice) - 1] = '\0';
continue;
}else
if(strcmp(argv[cnt], CMDLINE_MAXFILEBYTES) == 0)