Skip to content

Commit

Permalink
raise AccessDenied if info.pr_envp is empty, see #1091 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed May 28, 2017
1 parent 4158576 commit 90e7c4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 5 additions & 0 deletions psutil/_psutil_sunos.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ psutil_proc_environ(PyObject *self, PyObject *args) {
if (! psutil_file_to_struct(path, (void *)&info, sizeof(info)))
goto error;

if (! info.pr_envp) {
AccessDenied();
goto error;
}

env = psutil_read_raw_env(info, procfs_path, &env_count);
if (! env && env_count != 0)
goto error;
Expand Down
7 changes: 0 additions & 7 deletions psutil/arch/solaris/environ.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,6 @@ psutil_read_raw_env(psinfo_t info, const char *procfs_path, ssize_t *count) {
return NULL;
}

if (! info.pr_envp) {
if (count)
*count = 0;

return NULL;
}

as = open_address_space(info.pr_pid, procfs_path);
if (as < 0)
return NULL;
Expand Down

0 comments on commit 90e7c4a

Please sign in to comment.