diff --git a/dump/dump.c b/dump/dump.c index 73a231a..7e30f34 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -247,8 +247,7 @@ int main(int argc, char *argv[]) if (argc < 2) usage(); - memset(ui.dev_name, 0, sizeof(ui.dev_name)); - snprintf(ui.dev_name, sizeof(ui.dev_name), "%s", argv[1]); + ui.dev_name = argv[1]; ret = exfat_get_blk_dev_info(&ui, &bd); if (ret < 0) diff --git a/exfat2img/exfat2img.c b/exfat2img/exfat2img.c index bd9db44..e75b42f 100644 --- a/exfat2img/exfat2img.c +++ b/exfat2img/exfat2img.c @@ -926,7 +926,7 @@ int main(int argc, char * const argv[]) } memset(&ui, 0, sizeof(ui)); - snprintf(ui.dev_name, sizeof(ui.dev_name), "%s", blkdev_path); + ui.dev_name = blkdev_path; if (restore) ui.writeable = true; else diff --git a/fsck/fsck.c b/fsck/fsck.c index fe8a122..7cac445 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1616,7 +1616,7 @@ int main(int argc, char * const argv[]) exfat_fsck.options = ui.options; - snprintf(ui.ei.dev_name, sizeof(ui.ei.dev_name), "%s", argv[optind]); + ui.ei.dev_name = argv[optind]; ret = exfat_get_blk_dev_info(&ui.ei, &bd); if (ret < 0) { exfat_err("failed to open %s. %d\n", ui.ei.dev_name, ret); diff --git a/include/libexfat.h b/include/libexfat.h index 2ed9aa7..06b5498 100644 --- a/include/libexfat.h +++ b/include/libexfat.h @@ -78,7 +78,7 @@ struct exfat_blk_dev { }; struct exfat_user_input { - char dev_name[255]; + const char *dev_name; bool writeable; unsigned int sector_size; unsigned int cluster_size; diff --git a/label/label.c b/label/label.c index 2780143..c5eea7a 100644 --- a/label/label.c +++ b/label/label.c @@ -81,8 +81,7 @@ int main(int argc, char *argv[]) if (argc < 2) usage(); - memset(ui.dev_name, 0, sizeof(ui.dev_name)); - snprintf(ui.dev_name, sizeof(ui.dev_name), "%s", argv[serial_mode + 1]); + ui.dev_name = argv[serial_mode + 1]; ret = exfat_get_blk_dev_info(&ui, &bd); if (ret < 0) diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c index f9286c1..71f2b10 100644 --- a/mkfs/mkfs.c +++ b/mkfs/mkfs.c @@ -737,8 +737,7 @@ int main(int argc, char *argv[]) goto out; } - memset(ui.dev_name, 0, sizeof(ui.dev_name)); - snprintf(ui.dev_name, sizeof(ui.dev_name), "%s", argv[optind]); + ui.dev_name = argv[optind]; ret = exfat_get_blk_dev_info(&ui, &bd); if (ret < 0) diff --git a/tune/tune.c b/tune/tune.c index 4966e0a..218e840 100644 --- a/tune/tune.c +++ b/tune/tune.c @@ -118,8 +118,7 @@ int main(int argc, char *argv[]) if (argc < 3) usage(); - memset(ui.dev_name, 0, sizeof(ui.dev_name)); - snprintf(ui.dev_name, sizeof(ui.dev_name), "%s", argv[argc - 1]); + ui.dev_name = argv[argc - 1]; ret = exfat_get_blk_dev_info(&ui, &bd); if (ret < 0)