[lvm-devel] dev-next - gcc: ensure buffer ends with 0

David Teigland teigland at sourceware.org
Mon Mar 22 15:39:32 UTC 2021


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d37b19aaaab0c28f4d1e4ae0690c73c0031a027b
Commit:        d37b19aaaab0c28f4d1e4ae0690c73c0031a027b
Parent:        79d8d06217b6e0ac2ef8d0303ce84f748faebb9b
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Thu Mar 18 23:08:08 2021 +0100
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Fri Mar 19 23:21:18 2021 +0100

gcc: ensure buffer ends with 0

---
 lib/commands/toolcontext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 92008a641..75634caff 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -230,7 +230,7 @@ static void _get_sysfs_dir(struct cmd_context *cmd, char *buf, size_t buf_size)
 		return;
 	}
 
-	strncpy(buf, sys_mnt, buf_size);
+	(void) dm_strncpy(buf, sys_mnt, buf_size);
 }
 
 static uint32_t _parse_debug_fields(struct cmd_context *cmd, int cfg, const char *cfgname)




More information about the lvm-devel mailing list