123456789101112131415161718192021222324252627 |
- $OpenBSD: patch-Zend_zend_alloc_c,v 1.1 2016/02/06 23:30:25 sthen Exp $
- Apparently not enabled by default, and currently a bit close to release to
- try doing so, but for something in #ifdef MM_HEAP_PROTECTION, you want more
- than rand()^getpid() when /dev/urandom is inaccessible, right?
- --- Zend/zend_alloc.c.orig.port Mon Feb 1 23:04:02 2016
- +++ Zend/zend_alloc.c Mon Feb 1 23:34:27 2016
- @@ -976,6 +976,9 @@ static void zend_mm_free_cache(zend_mm_heap *heap)
- #if ZEND_MM_HEAP_PROTECTION || ZEND_MM_COOKIES
- static void zend_mm_random(unsigned char *buf, size_t size) /* {{{ */
- {
- +#if defined(__OpenBSD__)
- + arc4random_buf(buf, size);
- +#else
- size_t i = 0;
- unsigned char t;
-
- @@ -1031,6 +1034,7 @@ static void zend_mm_random(unsigned char *buf, size_t
- } while (buf[i] == 0);
- t = buf[i++] << 1;
- }
- +#endif /* openbsd */
- }
- /* }}} */
- #endif
|