perl.patch 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. "A security hole has been discovered in Safe.pm. When a Safe compartment
  2. has already been used, there's no guarantee that it's safe any longer,
  3. because there's a way for code executed within the Safe compartment to
  4. alter its operation mask. (Thus, programs that use a Safe compartment
  5. only once aren't affected by this bug.)"
  6. --- ext/Opcode/Safe.pm.orig
  7. +++ ext/Opcode/Safe.pm
  8. @@ -213,7 +213,7 @@
  9. # Create anon sub ref in root of compartment.
  10. # Uses a closure (on $expr) to pass in the code to be executed.
  11. # (eval on one line to keep line numbers as expected by caller)
  12. - my $evalcode = sprintf('package %s; sub { eval $expr; }', $root);
  13. + my $evalcode = sprintf('package %s; sub { @_ = (); eval $expr; }', $root);
  14. my $evalsub;
  15. if ($strict) { use strict; $evalsub = eval $evalcode; }
  16. @@ -227,7 +227,7 @@
  17. my $root = $obj->{Root};
  18. my $evalsub = eval
  19. - sprintf('package %s; sub { do $file }', $root);
  20. + sprintf('package %s; sub { @_ = (); do $file }', $root);
  21. return Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
  22. }
  23. -----------------------------------------------------------------------------
  24. By default, the Perl module search order is "use lib, -I, PERL[5]LIB,
  25. perl, site, vendor, other". This means that in OpenPKG both the modules
  26. installed via CPAN shell (in "site" area) and the "perl-xxx" packages
  27. (in "vendor" area) cannot override the (sometimes obsoleted) module
  28. versions distributed with Perl (in "perl" area). Hence, we change
  29. the search order to a more reasonable one for OpenPKG: "use lib, -I,
  30. PERL[5]LIB, site, vendor, perl, other".
  31. --- perl.c.orig 2002-07-09 21:41:43.000000000 +0200
  32. +++ perl.c 2003-09-03 14:08:25.000000000 +0200
  33. @@ -3679,39 +3679,6 @@
  34. incpush(APPLLIB_EXP, TRUE, TRUE);
  35. #endif
  36. -#ifdef ARCHLIB_EXP
  37. - incpush(ARCHLIB_EXP, FALSE, FALSE);
  38. -#endif
  39. -#ifdef MACOS_TRADITIONAL
  40. - {
  41. - Stat_t tmpstatbuf;
  42. - SV * privdir = NEWSV(55, 0);
  43. - char * macperl = PerlEnv_getenv("MACPERL");
  44. -
  45. - if (!macperl)
  46. - macperl = "";
  47. -
  48. - Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
  49. - if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  50. - incpush(SvPVX(privdir), TRUE, FALSE);
  51. - Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
  52. - if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  53. - incpush(SvPVX(privdir), TRUE, FALSE);
  54. -
  55. - SvREFCNT_dec(privdir);
  56. - }
  57. - if (!PL_tainting)
  58. - incpush(":", FALSE, FALSE);
  59. -#else
  60. -#ifndef PRIVLIB_EXP
  61. -# define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
  62. -#endif
  63. -#if defined(WIN32)
  64. - incpush(PRIVLIB_EXP, TRUE, FALSE);
  65. -#else
  66. - incpush(PRIVLIB_EXP, FALSE, FALSE);
  67. -#endif
  68. -
  69. #ifdef SITEARCH_EXP
  70. /* sitearch is always relative to sitelib on Windows for
  71. * DLL-based path intuition to work correctly */
  72. @@ -3752,6 +3719,39 @@
  73. incpush(PERL_VENDORLIB_STEM, FALSE, TRUE);
  74. #endif
  75. +#ifdef ARCHLIB_EXP
  76. + incpush(ARCHLIB_EXP, FALSE, FALSE);
  77. +#endif
  78. +#ifdef MACOS_TRADITIONAL
  79. + {
  80. + Stat_t tmpstatbuf;
  81. + SV * privdir = NEWSV(55, 0);
  82. + char * macperl = PerlEnv_getenv("MACPERL");
  83. +
  84. + if (!macperl)
  85. + macperl = "";
  86. +
  87. + Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
  88. + if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  89. + incpush(SvPVX(privdir), TRUE, FALSE);
  90. + Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
  91. + if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  92. + incpush(SvPVX(privdir), TRUE, FALSE);
  93. +
  94. + SvREFCNT_dec(privdir);
  95. + }
  96. + if (!PL_tainting)
  97. + incpush(":", FALSE, FALSE);
  98. +#else
  99. +#ifndef PRIVLIB_EXP
  100. +# define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
  101. +#endif
  102. +#if defined(WIN32)
  103. + incpush(PRIVLIB_EXP, TRUE, FALSE);
  104. +#else
  105. + incpush(PRIVLIB_EXP, FALSE, FALSE);
  106. +#endif
  107. +
  108. #ifdef PERL_OTHERLIBDIRS
  109. incpush(PERL_OTHERLIBDIRS, TRUE, TRUE);
  110. #endif
  111. -----------------------------------------------------------------------------
  112. By default, the "vendor" area is not used, so Perl's installation
  113. procedure forgot to create its top-level paths, too. In OpenPKG we use
  114. the "vendor" area, so make sure it is created the same way the "site"
  115. area is.
  116. --- installperl.orig 2002-07-16 20:57:32.000000000 +0200
  117. +++ installperl 2003-09-03 14:27:11.000000000 +0200
  118. @@ -174,6 +174,8 @@
  119. my $installarchlib = $Config{installarchlib};
  120. my $installsitelib = $Config{installsitelib};
  121. my $installsitearch = $Config{installsitearch};
  122. +my $installvendorlib = $Config{installvendorlib};
  123. +my $installvendorarch = $Config{installvendorarch};
  124. my $installman1dir = $Config{installman1dir};
  125. my $man1ext = $Config{man1ext};
  126. my $libperl = $Config{libperl};
  127. @@ -336,6 +338,8 @@
  128. mkpath($installarchlib, $verbose, 0777);
  129. mkpath($installsitelib, $verbose, 0777) if ($installsitelib);
  130. mkpath($installsitearch, $verbose, 0777) if ($installsitearch);
  131. +mkpath($installvendorlib, $verbose, 0777) if ($installvendorlib);
  132. +mkpath($installvendorarch, $verbose, 0777) if ($installvendorarch);
  133. if (chdir "lib") {
  134. $do_installarchlib = ! samepath($installarchlib, '.');
  135. -----------------------------------------------------------------------------
  136. http://stein.cshl.org/WWW/software/CGI/
  137. under "Revision History" find "Fixed cross-site scripting bug
  138. reported by obscure" note attached to Version 2.94. A quick fix was
  139. introduced in 2.94. It was replaced by a more careful patch in 2.99.
  140. http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2003-0615
  141. Cross-site scripting (XSS) vulnerability in start_form() of CGI.pm
  142. allows remote attackers to insert web script via a URL that is fed
  143. into the form's action parameter
  144. This is a backport of the 2.99 patch for 2.81 which is the version
  145. embedded with perl 5.8.0
  146. --- lib/CGI.pm.orig 2003-09-15 14:09:34.000000000 +0200
  147. +++ lib/CGI.pm 2003-09-15 14:16:26.000000000 +0200
  148. @@ -1533,8 +1533,11 @@
  149. $enctype = $enctype || &URL_ENCODED;
  150. unless (defined $action) {
  151. $action = $self->url(-absolute=>1,-path=>1);
  152. - $action .= "?$ENV{QUERY_STRING}" if $ENV{QUERY_STRING};
  153. + if (length($ENV{QUERY_STRING})>0) {
  154. + $action .= "?".$self->escapeHTML($ENV{QUERY_STRING},1);
  155. + }
  156. }
  157. + $action = escape($action);
  158. $action = qq(action="$action");
  159. my($other) = @other ? " @other" : '';
  160. $self->{'.parametersToAdd'}={};