summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2012-04-03 17:15:59 -0700
committerJan Dubois <jand@activestate.com>2012-04-16 13:43:26 -0700
commitbac5c4fca5109adea821c05bef9182e2dac95c81 (patch)
tree8130d951079d5cd2a0355e4bc55540eee707bef7 /perl.c
parent3607ca02d65ff63a9322effaf09e60361984e109 (diff)
downloadperl-bac5c4fca5109adea821c05bef9182e2dac95c81.tar.gz
SITELIB_EXP may be NULL on Windows
The sitelib directory is located dynamically at runtime by checking for the ../site path relative to the location of perl5xx.dll. This directory doesn't exist at buildtime, so calling strlen(NULL) may cause an access violation...
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/perl.c b/perl.c
index 5657432acd..7f6848e48e 100644
--- a/perl.c
+++ b/perl.c
@@ -2034,17 +2034,19 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
# else
/* SITELIB_EXP is a function call on Win32. */
const char *const raw_sitelib = SITELIB_EXP;
- /* process .../.. if PERL_RELOCATABLE_INC is defined */
- SV *sitelib_sv = mayberelocate(raw_sitelib, strlen(raw_sitelib),
- INCPUSH_CAN_RELOCATE);
- const char *const sitelib = SvPVX(sitelib_sv);
- (void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav,
- Perl_newSVpvf(aTHX_
- "BEGIN { do {local $!; -f q%c%s/sitecustomize.pl%c} && do q%c%s/sitecustomize.pl%c }",
- 0, sitelib, 0,
- 0, sitelib, 0));
- assert (SvREFCNT(sitelib_sv) == 1);
- SvREFCNT_dec(sitelib_sv);
+ if (raw_sitelib) {
+ /* process .../.. if PERL_RELOCATABLE_INC is defined */
+ SV *sitelib_sv = mayberelocate(raw_sitelib, strlen(raw_sitelib),
+ INCPUSH_CAN_RELOCATE);
+ const char *const sitelib = SvPVX(sitelib_sv);
+ (void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav,
+ Perl_newSVpvf(aTHX_
+ "BEGIN { do {local $!; -f q%c%s/sitecustomize.pl%c} && do q%c%s/sitecustomize.pl%c }",
+ 0, sitelib, 0,
+ 0, sitelib, 0));
+ assert (SvREFCNT(sitelib_sv) == 1);
+ SvREFCNT_dec(sitelib_sv);
+ }
# endif
}
#endif