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 /util.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 'util.c')
-rw-r--r-- | util.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -3115,9 +3115,13 @@ Perl_find_script(pTHX_ const char *scriptname, bool dosearch, if (len == 2 && tmpbuf[0] == '.') seen_dot = 1; #endif +#ifdef HAS_STRLCAT + (void)strlcpy(tmpbuf + len, scriptname, sizeof(tmpbuf) - len); +#else /* FIXME? Convert to memcpy by storing previous strlen(scriptname) */ (void)strcpy(tmpbuf + len, scriptname); +#endif /* #ifdef HAS_STRLCAT */ #endif /* !VMS */ #ifdef SEARCH_EXTS @@ -4290,7 +4294,11 @@ Perl_upg_version(pTHX_ SV *ver) if ( SvNOK(ver) ) /* may get too much accuracy */ { char tbuf[64]; - const STRLEN len = my_sprintf(tbuf,"%.9"NVgf, SvNVX(ver)); +#ifdef USE_SNPRINTF + const STRLEN len = snprintf(tbuf, sizeof(tbuf), "%.9"NVgf, SvNVX(ver)); +#else + const STRLEN len = my_sprintf(tbuf, "%.9"NVgf, SvNVX(ver)); +#endif /* #ifdef USE_SNPRINTF */ version = savepvn(tbuf, len); } #ifdef SvVOK |