This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
File-Glob/bsd_glob.c: use PerlEnv_getenv()
authorKarl Williamson <khw@cpan.org>
Sat, 7 Mar 2020 20:01:39 +0000 (13:01 -0700)
committerKarl Williamson <khw@cpan.org>
Thu, 19 Mar 2020 00:18:20 +0000 (18:18 -0600)
which has added protections beyond plain getenv()

ext/File-Glob/bsd_glob.c

index 0d042b4..b038dd1 100644 (file)
@@ -457,7 +457,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
                 * first and then trying the password file
                 * or $USERPROFILE on DOSISH systems
                 */
-               if ((h = getenv("HOME")) == NULL) {
+               if ((h = PerlEnv_getenv("HOME")) == NULL) {
 #ifdef HAS_PASSWD
                        struct passwd *pwd;
                        if ((pwd = getpwuid(getuid())) == NULL)
@@ -469,7 +469,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
                         * When no passwd file, fallback to the USERPROFILE
                         * environment variable on DOSish systems.
                         */
-                       if ((h = getenv("USERPROFILE")) == NULL) {
+                       if ((h = PerlEnv_getenv("USERPROFILE")) == NULL) {
                            return pattern;
                        }
 #else