summaryrefslogtreecommitdiff
path: root/cmds-restore.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-04-29 18:08:28 +0200
committerDavid Sterba <dsterba@suse.cz>2015-05-14 15:41:06 +0200
commitffd53c0fe893f8bc9f64706c1230134dde6f654e (patch)
tree6bdfd24962a497c7e6df353ef83a43d33c3b704d /cmds-restore.c
parentbd91f80725824fb0607d57dd4189521324e74c7d (diff)
btrfs-progs: restore: use bigger buffer for output path name
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-restore.c')
-rw-r--r--cmds-restore.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmds-restore.c b/cmds-restore.c
index 059fbf2c..d68f23d3 100644
--- a/cmds-restore.c
+++ b/cmds-restore.c
@@ -1412,7 +1412,7 @@ int cmd_restore(int argc, char **argv)
{
struct btrfs_root *root;
struct btrfs_key key;
- char dir_name[128];
+ char dir_name[PATH_MAX];
u64 tree_location = 0;
u64 fs_location = 0;
u64 root_objectid = 0;
@@ -1544,6 +1544,11 @@ int cmd_restore(int argc, char **argv)
memset(path_name, 0, PATH_MAX);
+ if (strlen(argv[optind + 1]) >= PATH_MAX) {
+ fprintf(stderr, "ERROR: path too long\n");
+ ret = 1;
+ goto out;
+ }
strncpy(dir_name, argv[optind + 1], sizeof dir_name);
dir_name[sizeof dir_name - 1] = 0;