diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-04-24 08:08:59 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-04-24 08:08:59 +0000 |
commit | 4305d8abee2315e02cb395dec9deede4e7f9f179 (patch) | |
tree | 589457fcbd396f8c384fbe3a221e3e0f2f3fc0f6 /pp_ctl.c | |
parent | 8bcaa1dfb69612366728f7905b96ca3f11eafd21 (diff) | |
download | perl-4305d8abee2315e02cb395dec9deede4e7f9f179.tar.gz |
avoid using uninitialized memory in require version check
p4raw-id: //depot/perl@5924
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -2916,8 +2916,8 @@ PP(pp_require) sv = POPs; if (SvNIOKp(sv)) { - UV rev, ver, sver; - if (SvPOKp(sv)) { /* require v5.6.1 */ + if (SvPOK(sv) && SvNOK(sv)) { /* require v5.6.1 */ + UV rev = 0, ver = 0, sver = 0; I32 len; U8 *s = (U8*)SvPVX(sv); U8 *end = (U8*)SvPVX(sv) + SvCUR(sv); @@ -2929,14 +2929,8 @@ PP(pp_require) s += len; if (s < end) sver = utf8_to_uv(s, &len); - else - sver = 0; } - else - ver = 0; } - else - rev = 0; if (PERL_REVISION < rev || (PERL_REVISION == rev && (PERL_VERSION < ver @@ -2947,6 +2941,7 @@ PP(pp_require) "v%d.%d.%d, stopped", rev, ver, sver, PERL_REVISION, PERL_VERSION, PERL_SUBVERSION); } + RETPUSHYES; } else if (!SvPOKp(sv)) { /* require 5.005_03 */ if ((NV)PERL_REVISION + ((NV)PERL_VERSION/(NV)1000) @@ -2975,8 +2970,8 @@ PP(pp_require) PERL_SUBVERSION); } } + RETPUSHYES; } - RETPUSHYES; } name = SvPV(sv, len); if (!(name && len > 0 && *name)) |