From: Rafael Garcia-Suarez Date: Tue, 24 Jan 2006 15:10:27 +0000 (+0000) Subject: Fix a regression on suidperl : the error message "No #! line" was X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8d2da6231d524e9fd538811e73b07868dff0ead;p=p5sagit%2Fp5-mst-13.2.git Fix a regression on suidperl : the error message "No #! line" was produced in erroneous cases, because we used to read values in a string buffer that pointed to nothing. p4raw-id: //depot/perl@26940 --- diff --git a/perl.c b/perl.c index d134c9f..0e412b1 100644 --- a/perl.c +++ b/perl.c @@ -3951,11 +3951,13 @@ S_validate_suid(pTHX_ const char *validarg, const char *scriptname) PL_doswitches = FALSE; /* -s is insecure in suid */ /* PSz 13 Nov 03 But -s was caught elsewhere ... so unsetting it here is useless(?!) */ CopLINE_inc(PL_curcop); + if (sv_gets(PL_linestr, PL_rsfp, 0) == Nullch) + Perl_croak(aTHX_ "No #! line"); linestr = SvPV_nolen_const(PL_linestr); - if (sv_gets(PL_linestr, PL_rsfp, 0) == Nullch || - strnNE(linestr,"#!",2) ) /* required even on Sys V */ + /* required even on Sys V */ + if (!*linestr || !linestr[1] || strnNE(linestr,"#!",2)) Perl_croak(aTHX_ "No #! line"); - linestr+=2; + linestr += 2; s = linestr; /* PSz 27 Feb 04 */ /* Sanity check on line length */