diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-10-16 17:31:47 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-10-16 17:31:47 +0000 |
commit | 70ace5dac0395f9f5ca5478d23db8cd1e0dbd6e7 (patch) | |
tree | d1238ded9e8a1ce521133cb599a6ef21de2d8951 /perlio.c | |
parent | a8fc9800e47fd3c23e88282f4505c051278ccc9b (diff) | |
download | perl-70ace5dac0395f9f5ca5478d23db8cd1e0dbd6e7.tar.gz |
When USE_ITHREADS avoid SV * in PerlIO_debug, at risk of buffer
overflow.
p4raw-id: //depot/perlio@12460
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -300,6 +300,19 @@ PerlIO_debug(const char *fmt, ...) } if (dbg > 0) { dTHX; +#ifdef USE_ITHREADS + /* Use fixed buffer as sv_catpvf etc. needs SVs */ + char buffer[1024]; + char *s; + STRLEN len; + s = CopFILE(PL_curcop); + if (!s) + s = "(none)"; + sprintf(buffer, "%s:%" IVdf " ", s, (IV) CopLINE(PL_curcop)); + len = strlen(buffer); + vsprintf(buffer+len, fmt, ap); + PerlLIO_write(dbg, buffer, strlen(buffer)); +#else SV *sv = newSVpvn("", 0); char *s; STRLEN len; @@ -313,6 +326,7 @@ PerlIO_debug(const char *fmt, ...) s = SvPV(sv, len); PerlLIO_write(dbg, s, len); SvREFCNT_dec(sv); +#endif } va_end(ap); } |