diff options
-rw-r--r-- | doio.c | 2 | ||||
-rw-r--r-- | op.c | 3 | ||||
-rw-r--r-- | perl.c | 7 | ||||
-rw-r--r-- | perlio.c | 8 | ||||
-rw-r--r-- | sv.c | 2 | ||||
-rw-r--r-- | toke.c | 3 | ||||
-rw-r--r-- | util.c | 2 |
7 files changed, 16 insertions, 11 deletions
@@ -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; @@ -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); } } @@ -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 @@ -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); } @@ -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; } @@ -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]; @@ -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 { |