From ce791de8e9ded220f39fbfe4cc5a0bd93b1e985f Mon Sep 17 00:00:00 2001 From: Zijun Hu Date: Fri, 26 May 2023 16:47:33 +0800 Subject: mkfs.ubifs: Fix mkfs.ubifs failure with option selinux Below failure happens when mkfs.ubifs --selinux=FILE ... "Error: bad file context FILE 1" "No such file or directory (error 2)" It is fixed by this change. Signed-off-by: Zijun Hu Signed-off-by: David Oberhollenzer --- ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c index 8211ada..15e6bdc 100644 --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c @@ -733,6 +733,7 @@ static int get_options(int argc, char**argv) if (!context) return err_msg("xmalloc failed\n"); memcpy(context, optarg, context_len); + context[context_len] = '\0'; /* Make sure root directory exists */ if (stat(context, &context_st)) -- cgit v1.2.3