summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-06-13 00:02:23 +0000
committerIgor Pashev <pashev.igor@gmail.com>2012-06-13 00:02:23 +0000
commitfc1f38bc8f315163500164ded80fe9af24103637 (patch)
tree0908137395764856073ae63583dae3a7c301b370
parent488687edf8ebc0da5fbedba66a5e4b57ea424bd7 (diff)
downloadshadow-fc1f38bc8f315163500164ded80fe9af24103637.tar.gz
RAND_MAX is for rand() only, and random() could exceed RAND_MAX
-rw-r--r--debian/patches/0020-random_rand_max.patch13
-rw-r--r--debian/patches/series1
2 files changed, 14 insertions, 0 deletions
diff --git a/debian/patches/0020-random_rand_max.patch b/debian/patches/0020-random_rand_max.patch
new file mode 100644
index 0000000..856c0c2
--- /dev/null
+++ b/debian/patches/0020-random_rand_max.patch
@@ -0,0 +1,13 @@
+diff --git a/libmisc/salt.c b/libmisc/salt.c
+index e0f278e..ba9f9a7 100644
+--- a/libmisc/salt.c
++++ b/libmisc/salt.c
+@@ -90,7 +90,7 @@ static size_t SHA_salt_size (void)
+ {
+ double rand_size;
+ seedRNG ();
+- rand_size = (double) 9.0 * random () / RAND_MAX;
++ rand_size = (double) 9.0 * random () / LONG_MAX;
+ return (size_t) (8 + rand_size);
+ }
+
diff --git a/debian/patches/series b/debian/patches/series
index 98b7f59..4a57f2a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -17,3 +17,4 @@
0017-environ.patch
0018-putgrent.patch
0019-putpwent-segfault.patch
+0020-random_rand_max.patch