patch-Zend_zend_alloc_c 860 B

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