summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doio.c2
-rw-r--r--op.c3
-rw-r--r--perl.c7
-rw-r--r--perlio.c8
-rw-r--r--sv.c2
-rw-r--r--toke.c3
-rw-r--r--util.c2
7 files changed, 16 insertions, 11 deletions
diff --git a/doio.c b/doio.c
index 76a632a003..be67c6e466 100644
--- a/doio.c
+++ b/doio.c
@@ -176,7 +176,7 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw,
IoTYPE(io) = PerlIO_intmode2str(rawmode, &mode[ix], &writing);
- namesv = sv_2mortal(newSVpvn(oname,strlen(oname)));
+ namesv = sv_2mortal(newSVpv(oname,0));
num_svs = 1;
svp = &namesv;
type = Nullch;
diff --git a/op.c b/op.c
index 2eefa1d1eb..2ca186c2b5 100644
--- a/op.c
+++ b/op.c
@@ -5940,8 +5940,9 @@ Perl_ck_require(pTHX_ OP *o)
for (s = SvPVX(sv); *s; s++) {
if (*s == ':' && s[1] == ':') {
+ const STRLEN len = strlen(s+2)+1;
*s = '/';
- Move(s+2, s+1, strlen(s+2)+1, char);
+ Move(s+2, s+1, len, char);
SvCUR_set(sv, SvCUR(sv) - 1);
}
}
diff --git a/perl.c b/perl.c
index 3e7ccde944..40c86c2af9 100644
--- a/perl.c
+++ b/perl.c
@@ -3818,6 +3818,7 @@ S_validate_suid(pTHX_ const char *validarg, const char *scriptname)
if (PL_statbuf.st_mode & (S_ISUID|S_ISGID)) {
I32 len;
const char *linestr;
+ const char *s_end;
#ifdef IAMSUID
if (PL_fdscript < 0 || PL_suidscript != 1)
@@ -3923,7 +3924,8 @@ S_validate_suid(pTHX_ const char *validarg, const char *scriptname)
s = linestr;
/* PSz 27 Feb 04 */
/* Sanity check on line length */
- if (strlen(s) < 1 || strlen(s) > 4000)
+ s_end = s + strlen(s);
+ if (s_end == s || (s_end - s) > 4000)
Perl_croak(aTHX_ "Very long #! line");
/* Allow more than a single space after #! */
while (isSPACE(*s)) s++;
@@ -3962,7 +3964,8 @@ S_validate_suid(pTHX_ const char *validarg, const char *scriptname)
len = strlen(validarg);
if (strEQ(validarg," PHOOEY ") ||
strnNE(s,validarg,len) || !isSPACE(s[len]) ||
- !(strlen(s) == len+1 || (strlen(s) == len+2 && isSPACE(s[len+1]))))
+ !((s_end - s) == len+1
+ || ((s_end - s) == len+2 && isSPACE(s[len+1]))))
Perl_croak(aTHX_ "Args must match #! line");
#ifndef IAMSUID
diff --git a/perlio.c b/perlio.c
index 8a2346184e..c7543d25c5 100644
--- a/perlio.c
+++ b/perlio.c
@@ -475,8 +475,8 @@ 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));
- vsprintf(buffer+len, fmt, ap);
- PerlLIO_write(PL_perlio_debug_fd, buffer, strlen(buffer));
+ const STRLEN len2 = vsprintf(buffer+len, fmt, ap);
+ PerlLIO_write(PL_perlio_debug_fd, buffer, len + len2);
#else
const char *s = CopFILE(PL_curcop);
STRLEN len;
@@ -4785,7 +4785,7 @@ PerlIO *
PerlIO_open(const char *path, const char *mode)
{
dTHX;
- SV *name = sv_2mortal(newSVpvn(path, strlen(path)));
+ SV *name = sv_2mortal(newSVpv(path, 0));
return PerlIO_openn(aTHX_ Nullch, mode, -1, 0, 0, NULL, 1, &name);
}
@@ -4794,7 +4794,7 @@ PerlIO *
PerlIO_reopen(const char *path, const char *mode, PerlIO *f)
{
dTHX;
- SV *name = sv_2mortal(newSVpvn(path, strlen(path)));
+ SV *name = sv_2mortal(newSVpv(path,0));
return PerlIO_openn(aTHX_ Nullch, mode, -1, 0, 0, f, 1, &name);
}
diff --git a/sv.c b/sv.c
index 3e7496954f..4b83f135e9 100644
--- a/sv.c
+++ b/sv.c
@@ -8720,7 +8720,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
{
q++; /* skip past the rest of the %vd format */
eptr = (const char *) vecstr;
- elen = strlen(eptr);
+ elen = veclen;
vectorize=FALSE;
goto string;
}
diff --git a/toke.c b/toke.c
index 0ec4e9fff6..cb13580249 100644
--- a/toke.c
+++ b/toke.c
@@ -681,7 +681,8 @@ S_incline(pTHX_ char *s)
if (t - s > 0) {
#ifndef USE_ITHREADS
const char * const cf = CopFILE(PL_curcop);
- if (cf && strlen(cf) > 7 && strnEQ(cf, "(eval ", 6)) {
+ STRLEN tmplen = cf ? strlen(cf) : 0;
+ if (tmplen > 7 && strnEQ(cf, "(eval ", 6)) {
/* must copy *{"::_<(eval N)[oldfilename:L]"}
* to *{"::_<newfilename"} */
char smallbuf[256], smallbuf2[256];
diff --git a/util.c b/util.c
index b558f7a121..4b115d28c8 100644
--- a/util.c
+++ b/util.c
@@ -3759,7 +3759,7 @@ Perl_getcwd_sv(pTHX_ register SV *sv)
* size from the heap if they are given a NULL buffer pointer.
* The problem is that this behaviour is not portable. */
if (getcwd(buf, sizeof(buf) - 1)) {
- sv_setpvn(sv, buf, strlen(buf));
+ sv_setpv(sv, buf);
return TRUE;
}
else {