Off-by-one. I'm so classic.
Jarkko Hietaniemi [Thu, 21 Jun 2001 21:38:38 +0000 (21:38 +0000)]
p4raw-id: //depot/perl@10801

util.c

diff --git a/util.c b/util.c
index d0d8454..feef339 100644 (file)
--- a/util.c
+++ b/util.c
@@ -3616,7 +3616,7 @@ Perl_sv_getcwd(pTHX_ register SV *sv)
        SvPOK_off(sv);
        New(0, buf, MAXPATHLEN, char);
        if (buf) {
-           buf[MAXPATHLEN] = 0;
+           buf[MAXPATHLEN - 1] = 0;
            /* Yes, some getcwd()s automatically allocate a buffer
             * if given a NULL one.  Portability is the problem.
             * XXX Configure probe needed. */