diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2006-04-25 21:23:39 +0300 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-04-28 02:12:03 +0000 |
commit | e80fed9da44c731a6f85b5544b737325bd9a41a7 (patch) | |
tree | ed45b5a4741d1cebf6930d3baf33fb3c0d808797 /perlio.c | |
parent | 658aef798ab992aed2b708fed0d12323ab3b1fcb (diff) | |
download | perl-e80fed9da44c731a6f85b5544b737325bd9a41a7.tar.gz |
Re: [PATCH] use snprintf/strlcpy/strlcat when useful
Message-ID: <444E3EFB.8020503@gmail.com>
p4raw-id: //depot/perl@27987
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -475,7 +475,11 @@ PerlIO_debug(const char *fmt, ...) /* Use fixed buffer as sv_catpvf etc. needs SVs */ char buffer[1024]; const STRLEN len = my_sprintf(buffer, "%.40s:%" IVdf " ", s ? s : "(none)", (IV) CopLINE(PL_curcop)); +# ifdef USE_VSNPRINTF + const STRLEN len2 = vnsprintf(buffer+len, sizeof(buffer) - len, fmt, ap); +# else const STRLEN len2 = vsprintf(buffer+len, fmt, ap); +# endif /* USE_VSNPRINTF */ PerlLIO_write(PL_perlio_debug_fd, buffer, len + len2); #else const char *s = CopFILE(PL_curcop); @@ -5135,7 +5139,11 @@ int PerlIO_vsprintf(char *s, int n, const char *fmt, va_list ap) { dVAR; +#ifdef USE_VSNPRINTF + const int val = vsnprintf(s, n, fmt, ap); +#else const int val = vsprintf(s, fmt, ap); +#endif /* #ifdef USE_VSNPRINTF */ if (n >= 0) { if (strlen(s) >= (STRLEN) n) { dTHX; |