Avoid a buffer overflow with threads and PERLIO_DEBUG
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 31 Jan 2005 08:35:51 +0000 (08:35 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 31 Jan 2005 08:35:51 +0000 (08:35 +0000)
p4raw-id: //depot/perl@23904

perlio.c

index 19b842e..85bc755 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -472,7 +472,7 @@ PerlIO_debug(const char *fmt, ...)
        s = CopFILE(PL_curcop);
        if (!s)
            s = "(none)";
-       sprintf(buffer, "%s:%" IVdf " ", s, (IV) CopLINE(PL_curcop));
+       sprintf(buffer, "%.40s:%" IVdf " ", s, (IV) CopLINE(PL_curcop));
        len = strlen(buffer);
        vsprintf(buffer+len, fmt, ap);
        PerlLIO_write(dbg, buffer, strlen(buffer));