diff options
| author | Karel Zak <kzak@redhat.com> | 2025-05-20 19:49:13 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2025-05-20 19:49:13 +0200 |
| commit | f8d41ab00438a85cc955b9b2004f3034b8fa6029 (patch) | |
| tree | 93091899dfeda5c3bce6884f0b81d0357ed88c73 /lib/env.c | |
| parent | 2461c23de03c450a6d399ad1870caf56460f77b8 (diff) | |
| parent | b36add06585acf77e1a50fc0d2c901a0129582a4 (diff) | |
| download | util-linux-f8d41ab00438a85cc955b9b2004f3034b8fa6029.tar.gz | |
Merge branch 'at_secure' of https://github.com/MaxKellermann/util-linux into PR/AT_SECURE
* 'at_secure' of https://github.com/MaxKellermann/util-linux:
lib/env, ...: use getauxval(AT_SECURE) for SUID check
Diffstat (limited to 'lib/env.c')
| -rw-r--r-- | lib/env.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -16,6 +16,7 @@ #include <sys/syscall.h> #endif #include <unistd.h> +#include <sys/auxv.h> // for getauxval() #include <sys/types.h> #include "env.h" @@ -260,7 +261,7 @@ void sanitize_env(void) char *safe_getenv(const char *arg) { - if ((getuid() != geteuid()) || (getgid() != getegid())) + if (getauxval(AT_SECURE)) return NULL; #ifdef HAVE_PRCTL if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) |
