diff options
author | loli10K <[email protected]> | 2019-07-09 00:10:23 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-07-08 15:10:23 -0700 |
commit | 1d20b763bb63782bb281173b1b82fe54fefaa624 (patch) | |
tree | b54001998c0c05991bc297fadce290fd46303375 /cmd/zfs | |
parent | f664f1ee7fc9dd7101171f6518c67951cb5bd8cf (diff) |
zfs send does not handle invalid input gracefully
Due to some changes introduced in 30af21b 'zfs send' can crash when
provided with invalid inputs: this change attempts to add more checks
to the affected code paths.
Reviewed-by: Attila Fülöp <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #9001
Diffstat (limited to 'cmd/zfs')
-rw-r--r-- | cmd/zfs/zfs_main.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index d9709ae62..0ebd16f6d 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -4338,7 +4338,11 @@ zfs_do_send(int argc, char **argv) return (1); } - cp = strchr(argv[0], '@'); + if ((cp = strchr(argv[0], '@')) == NULL) { + (void) fprintf(stderr, gettext("Error: " + "Unsupported flag with filesystem or bookmark.\n")); + return (1); + } *cp = '\0'; toname = cp + 1; zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); |