diff options
Diffstat (limited to 'debian/patches/0020-No-RAND_MAX-for-random.patch')
-rw-r--r-- | debian/patches/0020-No-RAND_MAX-for-random.patch | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/debian/patches/0020-No-RAND_MAX-for-random.patch b/debian/patches/0020-No-RAND_MAX-for-random.patch index 89890fe..9e313b8 100644 --- a/debian/patches/0020-No-RAND_MAX-for-random.patch +++ b/debian/patches/0020-No-RAND_MAX-for-random.patch @@ -6,25 +6,37 @@ Subject: No RAND_MAX for random() libmisc/salt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/libmisc/salt.c b/libmisc/salt.c -index e0f278e..1b650c2 100644 ---- a/libmisc/salt.c -+++ b/libmisc/salt.c -@@ -90,7 +90,7 @@ static size_t SHA_salt_size (void) +Index: b/libmisc/salt.c +=================================================================== +--- a/libmisc/salt.c 2013-07-27 19:32:39.176063851 +0400 ++++ b/libmisc/salt.c 2013-07-27 19:33:45.703451890 +0400 +@@ -27,6 +27,11 @@ + static /*@observer@*/const char *SHA_salt_rounds (/*@null@*/int *prefered_rounds); + #endif /* USE_SHA_CRYPT */ + ++#ifdef _RANDOM_MAX ++#undef _RANDOM_MAX ++#endif ++#define _RANDOM_MAX 2147483647L /* 2^31 - 1 */ ++ + #ifndef HAVE_L64A + static /*@observer@*/char *l64a(long value) + { +@@ -90,7 +95,7 @@ { double rand_size; seedRNG (); - rand_size = (double) 9.0 * random () / RAND_MAX; -+ rand_size = (double) 9.0 * random () / LONG_MAX; ++ rand_size = (double) 9.0 * random () / _RANDOM_MAX; return (size_t) (8 + rand_size); } -@@ -132,7 +132,7 @@ static /*@observer@*/const char *SHA_salt_rounds (/*@null@*/int *prefered_rounds +@@ -132,7 +137,7 @@ seedRNG (); rand_rounds = (double) (max_rounds-min_rounds+1.0) * random (); - rand_rounds /= RAND_MAX; -+ rand_rounds /= LONG_MAX; ++ rand_rounds /= _RANDOM_MAX; rounds = min_rounds + rand_rounds; } else if (0 == *prefered_rounds) { return ""; |