diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-06-28 22:02:03 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-06-28 22:02:03 +0000 |
commit | 490a0e9885933990f72b0e0485666a1f8522f018 (patch) | |
tree | e305a9cc03b9357176c15083062acb5852c21cdf /util.c | |
parent | 0cda2667486fc2b14e2c3c31787368885ae92aa2 (diff) | |
download | perl-490a0e9885933990f72b0e0485666a1f8522f018.tar.gz |
Convert strcpy to memcpy where we already know the length.
p4raw-id: //depot/perl@25007
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -765,7 +765,7 @@ Perl_savepv(pTHX_ const char *pv) char *newaddr; const STRLEN pvlen = strlen(pv)+1; New(902,newaddr,pvlen,char); - return strcpy(newaddr,pv); + return memcpy(newaddr,pv,pvlen); } } @@ -812,16 +812,18 @@ char * Perl_savesharedpv(pTHX_ const char *pv) { register char *newaddr; + STRLEN pvlen; if (!pv) return Nullch; - newaddr = (char*)PerlMemShared_malloc(strlen(pv)+1); + pvlen = strlen(pv)+1; + newaddr = (char*)PerlMemShared_malloc(pvlen); if (!newaddr) { PerlLIO_write(PerlIO_fileno(Perl_error_log), PL_no_mem, strlen(PL_no_mem)); my_exit(1); } - return strcpy(newaddr,pv); + return memcpy(newaddr,pv,pvlen); } /* @@ -2840,6 +2842,7 @@ Perl_find_script(pTHX_ const char *scriptname, bool dosearch, const char **searc len = strlen(scriptname); if (len+MAX_EXT_LEN+1 >= sizeof(tmpbuf)) break; + /* FIXME? Convert to memcpy */ cur = strcpy(tmpbuf, scriptname); } } while (extidx >= 0 && ext[extidx] /* try an extension? */ @@ -2894,15 +2897,17 @@ Perl_find_script(pTHX_ const char *scriptname, bool dosearch, const char **searc tmpbuf[len++] = ':'; #else if (len -#if defined(atarist) || defined(__MINT__) || defined(DOSISH) +# if defined(atarist) || defined(__MINT__) || defined(DOSISH) && tmpbuf[len - 1] != '/' && tmpbuf[len - 1] != '\\' -#endif +# endif ) tmpbuf[len++] = '/'; if (len == 2 && tmpbuf[0] == '.') seen_dot = 1; #endif + /* FIXME? Convert to memcpy by storing previous strlen(scriptname) + */ (void)strcpy(tmpbuf + len, scriptname); #endif /* !VMS */ |