summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2013-11-24 18:27:00 -0600
committerCraig A. Berry <craigberry@mac.com>2013-11-24 18:27:00 -0600
commitf420cce1268f3055e24f052a6b2c0afbbfea7624 (patch)
tree22ef1b2b22f00497455f386059ecbe950c635077 /perl.c
parent106793b61fcb516b154e40608eef7ef29caa9590 (diff)
downloadperl-f420cce1268f3055e24f052a6b2c0afbbfea7624.tar.gz
Fix VMS-specific wraparound error in S_mayberelocate.
In trimming the trailing slash from a Unix path spec, we haven't (since 5.003 or so) been ensuring that we weren't stepping off the beginning of the string. No, it's not normal to have '/' as a library path, but if it happens we shouldn't allow a zero or negative (actually wraparound since unsigned) value for the path length.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/perl.c b/perl.c
index 7652052242..827191520f 100644
--- a/perl.c
+++ b/perl.c
@@ -4529,7 +4529,7 @@ S_mayberelocate(pTHX_ const char *const dir, STRLEN len, U32 flags)
if ((unix = tounixspec_ts(SvPV(libdir,len),NULL)) != NULL) {
len = strlen(unix);
- while (unix[len-1] == '/') len--; /* Cosmetic */
+ while (len > 1 && unix[len-1] == '/') len--; /* Cosmetic */
sv_usepvn(libdir,unix,len);
}
else