From f459572950a50461b98d31ef34f4ac304ca2ad0f Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Mon, 5 Mar 2012 11:04:12 -0500 Subject: [PATCH] Ensure that the loop file name we pass to the kernel is always NUL-terminated Signed-off-by: David Zeuthen --- src/udiskslinuxmanager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/udiskslinuxmanager.c b/src/udiskslinuxmanager.c index 74be53c..8e4b76e 100644 --- a/src/udiskslinuxmanager.c +++ b/src/udiskslinuxmanager.c @@ -360,7 +360,7 @@ handle_loop_setup (UDisksManager *object, } memset (&li64, '\0', sizeof (li64)); - strncpy ((char *) li64.lo_file_name, path, LO_NAME_SIZE); + strncpy ((char *) li64.lo_file_name, path, LO_NAME_SIZE - 1); if (option_read_only) li64.lo_flags |= LO_FLAGS_READ_ONLY; /* TODO: we could have an option 'no-part-scan' but I don't think that's right */ -- 2.7.4