summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils.c3
-rw-r--r--utils.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/utils.c b/utils.c
index 4b3bace4..2a924161 100644
--- a/utils.c
+++ b/utils.c
@@ -66,7 +66,8 @@ void fixup_argv0(char **argv, const char *token)
void set_argv0(char **argv)
{
- sprintf(argv0_buf, "%s", argv[0]);
+ strncpy(argv0_buf, argv[0], sizeof(argv0_buf));
+ argv0_buf[sizeof(argv0_buf) - 1] = 0;
}
int check_argc_exact(int nargs, int expected)
diff --git a/utils.h b/utils.h
index 8c946246..289e86b4 100644
--- a/utils.h
+++ b/utils.h
@@ -38,7 +38,7 @@
#define BTRFS_UUID_UNPARSED_SIZE 37
-#define ARGV0_BUF_SIZE 64
+#define ARGV0_BUF_SIZE PATH_MAX
int check_argc_exact(int nargs, int expected);
int check_argc_min(int nargs, int expected);