Removed unused patches
This commit is contained in:
parent
59397e34d7
commit
0546fa1804
@ -1,112 +0,0 @@
|
|||||||
From ae37b791a73a9e78dedb89fb2429d2628cf58076 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tony Cook <tony@develop-help.com>
|
|
||||||
Date: Wed, 27 Jan 2016 11:52:15 +1100
|
|
||||||
Subject: [PATCH] remove duplicate environment variables from environ
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
If we see duplicate environment variables while iterating over
|
|
||||||
environ[]:
|
|
||||||
|
|
||||||
a) make sure we use the same value in %ENV that getenv() returns.
|
|
||||||
|
|
||||||
Previously on a duplicate, %ENV would have the last entry for the name
|
|
||||||
from environ[], but a typical getenv() would return the first entry.
|
|
||||||
|
|
||||||
Rather than assuming all getenv() implementations return the first entry
|
|
||||||
explicitly call getenv() to ensure they agree.
|
|
||||||
|
|
||||||
b) remove duplicate entries from environ
|
|
||||||
|
|
||||||
Previously if there was a duplicate definition for a name in environ[]
|
|
||||||
setting that name in %ENV could result in an unsafe value being passed
|
|
||||||
to a child process, so ensure environ[] has no duplicates.
|
|
||||||
|
|
||||||
CVE-2016-2381
|
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
perl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
|
||||||
1 file changed, 49 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/perl.c b/perl.c
|
|
||||||
index 4a324c6..5c71fd0 100644
|
|
||||||
--- a/perl.c
|
|
||||||
+++ b/perl.c
|
|
||||||
@@ -4329,23 +4329,70 @@ S_init_postdump_symbols(pTHX_ int argc, char **argv, char **env)
|
|
||||||
}
|
|
||||||
if (env) {
|
|
||||||
char *s, *old_var;
|
|
||||||
+ STRLEN nlen;
|
|
||||||
SV *sv;
|
|
||||||
+ HV *dups = newHV();
|
|
||||||
+
|
|
||||||
for (; *env; env++) {
|
|
||||||
old_var = *env;
|
|
||||||
|
|
||||||
if (!(s = strchr(old_var,'=')) || s == old_var)
|
|
||||||
continue;
|
|
||||||
+ nlen = s - old_var;
|
|
||||||
|
|
||||||
#if defined(MSDOS) && !defined(DJGPP)
|
|
||||||
*s = '\0';
|
|
||||||
(void)strupr(old_var);
|
|
||||||
*s = '=';
|
|
||||||
#endif
|
|
||||||
- sv = newSVpv(s+1, 0);
|
|
||||||
- (void)hv_store(hv, old_var, s - old_var, sv, 0);
|
|
||||||
+ if (hv_exists(hv, old_var, nlen)) {
|
|
||||||
+ const char *name = savepvn(old_var, nlen);
|
|
||||||
+
|
|
||||||
+ /* make sure we use the same value as getenv(), otherwise code that
|
|
||||||
+ uses getenv() (like setlocale()) might see a different value to %ENV
|
|
||||||
+ */
|
|
||||||
+ sv = newSVpv(PerlEnv_getenv(name), 0);
|
|
||||||
+
|
|
||||||
+ /* keep a count of the dups of this name so we can de-dup environ later */
|
|
||||||
+ if (hv_exists(dups, name, nlen))
|
|
||||||
+ ++SvIVX(*hv_fetch(dups, name, nlen, 0));
|
|
||||||
+ else
|
|
||||||
+ (void)hv_store(dups, name, nlen, newSViv(1), 0);
|
|
||||||
+
|
|
||||||
+ Safefree(name);
|
|
||||||
+ }
|
|
||||||
+ else {
|
|
||||||
+ sv = newSVpv(s+1, 0);
|
|
||||||
+ }
|
|
||||||
+ (void)hv_store(hv, old_var, nlen, sv, 0);
|
|
||||||
if (env_is_not_environ)
|
|
||||||
mg_set(sv);
|
|
||||||
}
|
|
||||||
+ if (HvKEYS(dups)) {
|
|
||||||
+ /* environ has some duplicate definitions, remove them */
|
|
||||||
+ HE *entry;
|
|
||||||
+ hv_iterinit(dups);
|
|
||||||
+ while ((entry = hv_iternext_flags(dups, 0))) {
|
|
||||||
+ STRLEN nlen;
|
|
||||||
+ const char *name = HePV(entry, nlen);
|
|
||||||
+ IV count = SvIV(HeVAL(entry));
|
|
||||||
+ IV i;
|
|
||||||
+ SV **valp = hv_fetch(hv, name, nlen, 0);
|
|
||||||
+
|
|
||||||
+ assert(valp);
|
|
||||||
+
|
|
||||||
+ /* try to remove any duplicate names, depending on the
|
|
||||||
+ * implementation used in my_setenv() the iteration might
|
|
||||||
+ * not be necessary, but let's be safe.
|
|
||||||
+ */
|
|
||||||
+ for (i = 0; i < count; ++i)
|
|
||||||
+ my_setenv(name, 0);
|
|
||||||
+
|
|
||||||
+ /* and set it back to the value we set $ENV{name} to */
|
|
||||||
+ my_setenv(name, SvPV_nolen(*valp));
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ SvREFCNT_dec_NN(dups);
|
|
||||||
}
|
|
||||||
#endif /* USE_ENVIRON_ARRAY */
|
|
||||||
#endif /* !PERL_MICRO */
|
|
||||||
--
|
|
||||||
2.5.0
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
diff -up perl-5.16.0-RC2/t/porting/known_pod_issues.dat.pody perl-5.16.0-RC2/t/porting/known_pod_issues.dat
|
|
||||||
--- perl-5.16.0-RC2/t/porting/known_pod_issues.dat.pody 2012-05-14 21:49:22.000000000 +0200
|
|
||||||
+++ perl-5.16.0-RC2/t/porting/known_pod_issues.dat 2012-05-16 14:21:00.000000000 +0200
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-# This file is the data file for porting/podcheck.t.
|
|
||||||
+# This file is the data file for t/porting/podcheck.t.
|
|
||||||
# There are three types of lines.
|
|
||||||
# Comment lines are white-space only or begin with a '#', like this one. Any
|
|
||||||
# changes you make to the comment lines will be lost when the file is
|
|
||||||
@@ -217,6 +217,7 @@ pod/perlbook.pod Verbatim line length in
|
|
||||||
pod/perlcall.pod Verbatim line length including indents exceeds 79 by 2
|
|
||||||
pod/perlce.pod Verbatim line length including indents exceeds 79 by 2
|
|
||||||
pod/perlclib.pod Verbatim line length including indents exceeds 79 by 3
|
|
||||||
+pod/perlcn.pod Verbatim line length including indents exceeds 79 by 1
|
|
||||||
pod/perlcygwin.pod Verbatim line length including indents exceeds 79 by 25
|
|
||||||
pod/perldbmfilter.pod Verbatim line length including indents exceeds 79 by 1
|
|
||||||
pod/perldebguts.pod Verbatim line length including indents exceeds 79 by 68
|
|
||||||
@@ -248,6 +249,8 @@ pod/perliol.pod Verbatim line length inc
|
|
||||||
pod/perlipc.pod Apparent broken link 1
|
|
||||||
pod/perlipc.pod Verbatim line length including indents exceeds 79 by 19
|
|
||||||
pod/perlirix.pod Verbatim line length including indents exceeds 79 by 4
|
|
||||||
+pod/perljp.pod Verbatim line length including indents exceeds 79 by 1
|
|
||||||
+pod/perlko.pod Verbatim line length including indents exceeds 79 by 22
|
|
||||||
pod/perllol.pod Verbatim line length including indents exceeds 79 by 4
|
|
||||||
pod/perlmacosx.pod Verbatim line length including indents exceeds 79 by 3
|
|
||||||
pod/perlmod.pod Verbatim line length including indents exceeds 79 by 2
|
|
Loading…
Reference in New Issue
Block a user