aboutsummaryrefslogtreecommitdiff
path: root/lib
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 /lib
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 'lib')
-rw-r--r--lib/libubi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libubi.c b/lib/libubi.c
index afe3648..baaca2f 100644
--- a/lib/libubi.c
+++ b/lib/libubi.c
@@ -1008,7 +1008,8 @@ int ubi_mkvol(libubi_t desc, const char *node, struct ubi_mkvol_request *req)
if (n > UBI_MAX_VOLUME_NAME)
return -1;
- strncpy(r.name, req->name, UBI_MAX_VOLUME_NAME + 1);
+ strncpy(r.name, req->name, UBI_MAX_VOLUME_NAME);
+ r.name[UBI_MAX_VOLUME_NAME] = '\0';
r.name_len = n;
fd = open(node, O_RDONLY);