libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 51c0610aacf7d259afaf079af0bafc9ea53ce21f
parent 90a1fbd3658995b8a6ef55ddd8a9e75087449343
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 28 Jul 2026 23:10:06 +0200

fix #11609

Diffstat:
Mconfigure.ac | 3+--
Msrc/main/extractor_plugpath.c | 16++++++++++++++--
2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -20,7 +20,6 @@ AC_INIT([libextractor],[1.17],[bug-libextractor@gnu.org]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) -AH_TOP([#define _GNU_SOURCE 1]) AC_CANONICAL_TARGET AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -476,7 +475,7 @@ AC_FUNC_STAT AC_FUNC_ERROR_AT_LINE AC_SEARCH_LIBS(dlopen, dl) AC_SEARCH_LIBS(shm_open, rt) -AC_CHECK_FUNCS([mkstemp strndup munmap strcasecmp strdup strncasecmp memmove memset strtoul floor getcwd pow setenv sqrt strchr strcspn strrchr strnlen strndup ftruncate shm_open shm_unlink lseek64]) +AC_CHECK_FUNCS([mkstemp strndup munmap strcasecmp strdup strncasecmp memmove memset strtoul floor getcwd pow setenv sqrt strchr strcspn strrchr strnlen strndup ftruncate shm_open shm_unlink lseek64 secure_getenv issetugid]) # is kind of tedious, but simple and straightforward diff --git a/src/main/extractor_plugpath.c b/src/main/extractor_plugpath.c @@ -470,12 +470,24 @@ get_installation_paths (EXTRACTOR_PathProcessor pp, bool skip; /* true if we should skip GETENV */ prefix = NULL; -#if _GNU_SOURCE +#ifdef HAVE_SECURE_GETENV + /* secure_getenv() already ignores the environment in secure execution + mode, so we never have to suppress the lookup ourselves */ #define GETENV secure_getenv skip = false; +#elif WINDOWS + /* no set-user-ID/set-group-ID notion to worry about */ + #define GETENV getenv + skip = false; +#elif defined(HAVE_ISSETUGID) + #define GETENV getenv + skip = (0 != issetugid ()); #else + /* poor man's approximation of the secure execution mode test + that secure_getenv() would do for us */ #define GETENV getenv - skip = (0 == geteuid ()); + skip = ( (getuid () != geteuid ()) || + (getgid () != getegid ()) ); #endif if ( (! skip) &&