Change 19035 by [EMAIL PROTECTED] on 2003/03/20 05:22:27

        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

Affected files ...

... //depot/maint-5.8/perl/doio.c#10 integrate
... //depot/maint-5.8/perl/win32/win32.c#6 integrate

Differences ...

==== //depot/maint-5.8/perl/doio.c#10 (text) ====
Index: perl/doio.c
--- perl/doio.c#9~18978~        Fri Mar 14 02:52:06 2003
+++ perl/doio.c Wed Mar 19 21:22:27 2003
@@ -1321,7 +1321,7 @@
     else {
        SV* sv = POPs;
        char *s;
-       STRLEN n_a;
+       STRLEN len;
        PUTBACK;
        if (SvTYPE(sv) == SVt_PVGV) {
            gv = (GV*)sv;
@@ -1332,9 +1332,10 @@
            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'))

==== //depot/maint-5.8/perl/win32/win32.c#6 (text) ====
Index: perl/win32/win32.c
--- perl/win32/win32.c#5~18414~ Fri Jan  3 08:39:33 2003
+++ perl/win32/win32.c  Wed Mar 19 21:22:27 2003
@@ -4647,6 +4647,7 @@
     } 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 @@
            items = 2;
        }
        SvCUR_set(fullpath,len);
+       *SvEND(fullpath) = '\0';
        ST(0) = fullpath;
        XSRETURN(items);
     }
End of Patch.

Reply via email to