summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorGiuseppe Di Natale <[email protected]>2017-07-24 11:53:59 -0700
committerBrian Behlendorf <[email protected]>2017-07-24 11:53:59 -0700
commitd6bcf7ff5e97df3195d34269b1b72952b4a00778 (patch)
tree1ed95841987537672e5e81bb5e089a2d9aea5b5a /cmd
parentb6e5c40382a52206f48cb26cc20ed85294e1b0a9 (diff)
Restrict zpool iostat/status -c to search path
zpool iostat/status -c is supposed to be restricted by its search path, but currently isn't. To prevent arbitrary scripts from being executed, disallow '/' from commands. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Ned Bass <[email protected]> Signed-off-by: Giuseppe Di Natale <[email protected]> Closes #6353 Closes #6359
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zpool/zpool_iter.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmd/zpool/zpool_iter.c b/cmd/zpool/zpool_iter.c
index abb1b1798..e55c2f102 100644
--- a/cmd/zpool/zpool_iter.c
+++ b/cmd/zpool/zpool_iter.c
@@ -565,6 +565,9 @@ vdev_run_cmd_thread(void *cb_cmd_data)
char *dir = NULL, *sp, *sprest;
char fullpath[MAXPATHLEN];
+ if (strchr(cmd, '/') != NULL)
+ continue;
+
sp = zpool_get_cmd_search_path();
if (sp == NULL)
continue;