mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 04:04:35 +03:00
Security review: make privilege dropping-restoring optional.
This is/was necessary only on macOS, because you needed root in order to read the process list. This was never necessary on Linux, and it also raises security concerns, so now it needs to be enabled explicitly at build time.
This commit is contained in:
@ -48,10 +48,9 @@ void EnvScreen_scan(InfoScreen* this) {
|
||||
|
||||
Panel_prune(panel);
|
||||
|
||||
uid_t euid = geteuid();
|
||||
(void) seteuid(getuid());
|
||||
char *env = Platform_getProcessEnv(this->process->pid);
|
||||
(void) seteuid(euid);
|
||||
CRT_dropPrivileges();
|
||||
char* env = Platform_getProcessEnv(this->process->pid);
|
||||
CRT_restorePrivileges();
|
||||
if (env) {
|
||||
for (char *p = env; *p; p = strrchr(p, 0)+1)
|
||||
InfoScreen_addLine(this, p);
|
||||
|
Reference in New Issue
Block a user