Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
file.16613
file-secure_getenv.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File file-secure_getenv.patch of Package file.16613
--- file-5.29/configure.ac | 2 ++ file-5.29/src/file.c | 2 +- file-5.29/src/file.h | 8 ++++++++ file-5.29/src/magic.c | 10 +++++----- 4 files changed, 16 insertions(+), 6 deletions(-) Index: file-5.32/configure.ac =================================================================== --- file-5.32.orig/configure.ac +++ file-5.32/configure.ac @@ -97,6 +97,8 @@ AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_S #include <signal.h> #endif]) +AC_CHECK_FUNCS([__secure_getenv secure_getenv]) + dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T Index: file-5.32/src/file.h =================================================================== --- file-5.32.orig/src/file.h +++ file-5.32/src/file.h @@ -615,4 +615,12 @@ static const char *rcsid(const char *p) #define __RCSID(a) #endif +#ifndef HAVE_SECURE_GETENV +# ifdef HAVE___SECURE_GETENV +# define secure_getenv __secure_getenv +# else +# error neither secure_getenv nor __secure_getenv is available +# endif +#endif + #endif /* __file_h__ */ Index: file-5.32/src/magic.c =================================================================== --- file-5.32.orig/src/magic.c +++ file-5.32/src/magic.c @@ -185,7 +185,7 @@ get_default_magic(void) free(default_magic); default_magic = NULL; } - if ((home = getenv("HOME")) == NULL) + if ((home = secure_getenv("HOME")) == NULL) return MAGIC; if (asprintf(&hmagicpath, "%s/.magic.mgc", home) < 0) @@ -222,16 +222,16 @@ out: } /* First, try to get a magic file from user-application data */ - if ((home = getenv("LOCALAPPDATA")) != NULL) + if ((home = secure_getenv("LOCALAPPDATA")) != NULL) _w32_append_path(&hmagicpath, "%s%s", home, hmagic); /* Second, try to get a magic file from the user profile data */ - if ((home = getenv("USERPROFILE")) != NULL) + if ((home = secure_getenv("USERPROFILE")) != NULL) _w32_append_path(&hmagicpath, "%s/Local Settings/Application Data%s", home, hmagic); /* Third, try to get a magic file from Common Files */ - if ((home = getenv("COMMONPROGRAMFILES")) != NULL) + if ((home = secure_getenv("COMMONPROGRAMFILES")) != NULL) _w32_append_path(&hmagicpath, "%s%s", home, hmagic); /* Fourth, try to get magic file relative to exe location */ @@ -252,7 +252,7 @@ magic_getpath(const char *magicfile, int if (magicfile != NULL) return magicfile; - magicfile = getenv("MAGIC"); + magicfile = secure_getenv("MAGIC"); if (magicfile != NULL) return magicfile;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor