diff options
author | Pete Travis <immanetize@fedoraproject.org> | 2014-10-01 11:59:35 -0600 |
---|---|---|
committer | Pete Travis <immanetize@fedoraproject.org> | 2014-10-01 11:59:35 -0600 |
commit | 4a895d111d1b13ddb624a8d055d217e695361447 (patch) | |
tree | 03c8d4640a38d58fbdc5c8ef5458a2613f55e3fb /SOURCES/bash-4.0-security.patch | |
parent | f5afed3fb60ea2a362cfd696b9edf259ca33e1da (diff) | |
download | rpmbuild-sles11.2-bash.tar.gz rpmbuild-sles11.2-bash.tar.xz rpmbuild-sles11.2-bash.zip |
sles 11.2 bash, in wholesles11.2-bash
Diffstat (limited to 'SOURCES/bash-4.0-security.patch')
-rw-r--r-- | SOURCES/bash-4.0-security.patch | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/SOURCES/bash-4.0-security.patch b/SOURCES/bash-4.0-security.patch new file mode 100644 index 0000000..2b60b9d --- /dev/null +++ b/SOURCES/bash-4.0-security.patch @@ -0,0 +1,85 @@ +Index: variables.c +=================================================================== +--- variables.c.orig ++++ variables.c +@@ -1203,6 +1203,7 @@ init_seconds_var () + return v; + } + ++#if !defined(linux) + /* The random number seed. You can change this by setting RANDOM. */ + static unsigned long rseed = 1; + static int last_random_value; +@@ -1256,6 +1257,24 @@ seedrand () + sbrand (tv.tv_sec ^ tv.tv_usec ^ getpid ()); + } + ++#else ++ ++static int last_sbrand_pid; ++ ++static int brand () ++{ ++ return random() & 32767; ++} ++ ++static void sbrand (unsigned long seed) ++{ ++ srandom(seed); ++} ++ ++static void ++seedrand () {} ++#endif ++ + static SHELL_VAR * + assign_random (self, value, unused, key) + SHELL_VAR *self; +@@ -1264,8 +1283,10 @@ assign_random (self, value, unused, key) + char *key; + { + sbrand (strtoul (value, (char **)NULL, 10)); ++#if !defined(linux) + if (subshell_environment) + seeded_subshell = getpid (); ++#endif + return (self); + } + +@@ -1274,6 +1295,7 @@ get_random_number () + { + int rv, pid; + ++#if !defined(linux) + /* Reset for command and process substitution. */ + pid = getpid (); + if (subshell_environment && seeded_subshell != pid) +@@ -1285,6 +1307,18 @@ get_random_number () + do + rv = brand (); + while (rv == last_random_value); ++#else ++ if (subshell_environment) ++ { ++ int mypid = getpid(); ++ if (mypid != last_sbrand_pid) ++ { ++ last_sbrand_pid = mypid; ++ sbrand (mypid + NOW); ++ } ++ } ++ rv = brand(); ++#endif + return rv; + } + +@@ -1296,7 +1330,9 @@ get_random (var) + char *p; + + rv = get_random_number (); ++#if !defined(linux) + last_random_value = rv; ++#endif + p = itos (rv); + + FREE (value_cell (var)); |