diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-20 05:23:15 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-20 05:23:15 +0000 |
commit | 4ecd490ccf7bf09140e24e001c5acc2d417d685c (patch) | |
tree | c43dc9282d0b378beb87dc2a0ad71b929d40c9f6 | |
parent | 7f274f0f6c9842ea688f851b8245ef7d42203120 (diff) | |
download | perl-4ecd490ccf7bf09140e24e001c5acc2d417d685c.tar.gz |
Integrate:
[ 19033]
file test operators weren't doing the right thing if the SV
passed to them wasn't NUL-terminated
[ 19034]
ensure SVs returned by Win32::Get{Short,Full}PathName() are
NUL-terminated
p4raw-link: @19034 on //depot/maint-5.6/perl: d453a28c5f70420dd114c2f0f61ec1aaf34109e0
p4raw-link: @19033 on //depot/maint-5.6/perl: 1ad7974d3a92321c870ce2bd5ce4e57098b51c10
p4raw-id: //depot/perl@19036
p4raw-integrated: from //depot/maint-5.6/perl@19028 'merge in' doio.c
(@16333..) win32/win32.c (@18377..)
-rw-r--r-- | doio.c | 7 | ||||
-rw-r--r-- | win32/win32.c | 2 |
2 files changed, 6 insertions, 3 deletions
@@ -1321,7 +1321,7 @@ Perl_my_stat(pTHX) else { SV* sv = POPs; char *s; - STRLEN n_a; + STRLEN len; PUTBACK; if (SvTYPE(sv) == SVt_PVGV) { gv = (GV*)sv; @@ -1332,9 +1332,10 @@ Perl_my_stat(pTHX) goto do_fstat; } - s = SvPV(sv, n_a); + s = SvPV(sv, len); PL_statgv = Nullgv; - sv_setpv(PL_statname, s); + sv_setpvn(PL_statname, s, len); + s = SvPVX(PL_statname); /* s now NUL-terminated */ PL_laststype = OP_STAT; PL_laststatval = PerlLIO_stat(s, &PL_statcache); if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(s, '\n')) diff --git a/win32/win32.c b/win32/win32.c index 070ee9c132..87665ff372 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4647,6 +4647,7 @@ XS(w32_GetShortPathName) } while (len >= SvLEN(shortpath) && sv_grow(shortpath,len+1)); if (len) { SvCUR_set(shortpath,len); + *SvEND(shortpath) = '\0'; ST(0) = shortpath; XSRETURN(1); } @@ -4690,6 +4691,7 @@ XS(w32_GetFullPathName) items = 2; } SvCUR_set(fullpath,len); + *SvEND(fullpath) = '\0'; ST(0) = fullpath; XSRETURN(items); } |