Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
python-magic.6206
file-secure_getenv.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File file-secure_getenv.patch of Package python-magic.6206
--- file-5.18.orig/configure.ac +++ file-5.18/configure.ac @@ -86,6 +86,8 @@ AC_CHECK_HEADERS(getopt.h err.h) AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) AC_CHECK_HEADERS(zlib.h) +AC_CHECK_FUNCS([__secure_getenv secure_getenv]) + dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T --- file-5.18.orig/src/file.h +++ file-5.18/src/file.h @@ -541,4 +541,12 @@ static const char *rcsid(const char *p) #define FILE_RCSID(id) #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__ */ --- file-5.18.orig/src/magic.c +++ file-5.18/src/magic.c @@ -97,7 +97,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) @@ -152,8 +152,8 @@ out: } /* First, try to get user-specific magic file */ - if ((home = getenv("LOCALAPPDATA")) == NULL) { - if ((home = getenv("USERPROFILE")) != NULL) + if ((home = secure_getenv("LOCALAPPDATA")) == NULL) { + if ((home = secure_getenv("USERPROFILE")) != NULL) if (asprintf(&tmppath, "%s/Local Settings/Application Data%s", home, hmagic) < 0) @@ -166,7 +166,7 @@ out: APPENDPATH(); /* Second, try to get a magic file from Common Files */ - if ((home = getenv("COMMONPROGRAMFILES")) != NULL) { + if ((home = secure_getenv("COMMONPROGRAMFILES")) != NULL) { if (asprintf(&tmppath, "%s%s", home, hmagic) >= 0) APPENDPATH(); } @@ -204,7 +204,7 @@ magic_getpath(const char *magicfile, int if (magicfile != NULL) return magicfile; - magicfile = getenv("MAGIC"); + magicfile = secure_getenv("MAGIC"); if (magicfile != NULL) return magicfile; --- file-5.18.orig/src/file.c +++ file-5.18/src/file.c @@ -530,7 +530,7 @@ docprint(const char *opts) private void help(void) { - const unsigned long posix = (unsigned long)getenv("POSIXLY_CORRECT"); + const unsigned long posix = (unsigned long)secure_getenv("POSIXLY_CORRECT"); (void)fputs( "Usage: file [OPTION...] [FILE...]\n" "Determine type of FILEs.\n"
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