This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Replace ^M by a space in test for bug #37716, to make
[perl5.git] / perl.c
diff --git a/perl.c b/perl.c
index 3e7ccde..4b005b6 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -138,9 +138,10 @@ static I32 read_e_script(pTHX_ int idx, SV *buf_sv, int maxlen);
 #endif
 
 #ifndef NO_MATHOMS
-/* This reference ensure that the mathoms are linked with perl */
-void Perl_mathoms_ref() {
-    extern void Perl_mathoms();
+/* This reference ensures that the mathoms are linked with perl */
+extern void Perl_mathoms(void);
+void Perl_mathoms_ref(void);
+void Perl_mathoms_ref(void) {
     Perl_mathoms();
 }
 #endif
@@ -1758,6 +1759,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
 #  ifdef MYMALLOC
                             " MYMALLOC"
 #  endif
+#  ifdef NO_MATHOMS
+                            " NO_MATHOMS"
+#  endif
 #  ifdef PERL_DONT_CREATE_GVSV
                             " PERL_DONT_CREATE_GVSV"
 #  endif
@@ -1782,6 +1786,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
 #  ifdef PERL_OLD_COPY_ON_WRITE
                             " PERL_OLD_COPY_ON_WRITE"
 #  endif
+#  ifdef PERL_TRACK_MEMPOOL
+                            " PERL_TRACK_MEMPOOL"
+#  endif
 #  ifdef PERL_USE_SAFE_PUTENV
                             " PERL_USE_SAFE_PUTENV"
 #  endif
@@ -3818,6 +3825,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 +3931,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 +3971,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