summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-01-24 15:10:27 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-01-24 15:10:27 +0000
commit71a0b60e31aac07d918508c45513abf49c427e23 (patch)
treea7e6c5d695588f53ca50d14d8f5c91322885317b /perl.c
parentef481ae6bc613b58a35a82db01346b0eed7cf8e3 (diff)
downloadperl-71a0b60e31aac07d918508c45513abf49c427e23.tar.gz
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
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/perl.c b/perl.c
index d134c9f4d0..0e412b12d0 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 */