mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Fix segfault in zfs_do_bookmark()
When invoked with wrong parameters 'zfs bookmark' fails to gracefully validate user input and crashes. This is a regression accidentally introduced in 587e228; this commit adds additional tests to the ZFS Test Suite to exercise this codepath. Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: KireinaHoro <i@jsteward.moe> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes #7228 Closes #7229
This commit is contained in:
@@ -7112,6 +7112,12 @@ zfs_do_bookmark(int argc, char **argv)
|
||||
goto usage;
|
||||
}
|
||||
|
||||
if (strchr(argv[0], '@') == NULL) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid snapshot name '%s': "
|
||||
"must contain a '@'\n"), argv[0]);
|
||||
goto usage;
|
||||
}
|
||||
if (strchr(argv[1], '#') == NULL) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid bookmark name '%s': "
|
||||
|
||||
Reference in New Issue
Block a user