SecBSD's official ports repository
This commit is contained in:
commit
2c0afcbbf3
64331 changed files with 5339189 additions and 0 deletions
51
textproc/libxml/patches/patch-dict_c
Normal file
51
textproc/libxml/patches/patch-dict_c
Normal file
|
@ -0,0 +1,51 @@
|
|||
Index: dict.c
|
||||
--- dict.c.orig
|
||||
+++ dict.c
|
||||
@@ -37,7 +37,7 @@
|
||||
* list we will use the BigKey algo as soon as the hash size grows
|
||||
* over MIN_DICT_SIZE so this actually works
|
||||
*/
|
||||
-#if !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
||||
+#if !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) || defined(HAVE_ARC4RANDOM)
|
||||
#define DICT_RANDOMIZATION
|
||||
#endif
|
||||
|
||||
@@ -133,7 +133,7 @@ struct _xmlDict {
|
||||
static xmlMutex xmlDictMutex;
|
||||
|
||||
#ifdef DICT_RANDOMIZATION
|
||||
-#ifdef HAVE_RAND_R
|
||||
+#if defined(HAVE_RAND_R) && !defined(HAVE_ARC4RANDOM)
|
||||
/*
|
||||
* Internal data for random function, protected by xmlDictMutex
|
||||
*/
|
||||
@@ -160,7 +160,7 @@ int xmlInitializeDict(void) {
|
||||
int __xmlInitializeDict(void) {
|
||||
xmlInitMutex(&xmlDictMutex);
|
||||
|
||||
-#ifdef DICT_RANDOMIZATION
|
||||
+#if defined(DICT_RANDOMIZATION) && !defined(HAVE_ARC4RANDOM)
|
||||
#ifdef HAVE_RAND_R
|
||||
rand_seed = time(NULL);
|
||||
rand_r(& rand_seed);
|
||||
@@ -175,13 +175,17 @@ int __xmlInitializeDict(void) {
|
||||
int __xmlRandom(void) {
|
||||
int ret;
|
||||
|
||||
+#ifdef HAVE_ARC4RANDOM
|
||||
+ ret = arc4random();
|
||||
+#else
|
||||
xmlMutexLock(&xmlDictMutex);
|
||||
-#ifdef HAVE_RAND_R
|
||||
+# ifdef HAVE_RAND_R
|
||||
ret = rand_r(& rand_seed);
|
||||
-#else
|
||||
+# else
|
||||
ret = rand();
|
||||
-#endif
|
||||
+# endif
|
||||
xmlMutexUnlock(&xmlDictMutex);
|
||||
+#endif
|
||||
return(ret);
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue