Ticket #17815: tor_rand_2.diff

File tor_rand_2.diff, 608 bytes (added by logan, 4 years ago)
  • src/ext/OpenBSD_malloc_Linux.c

    diff --git a/src/ext/OpenBSD_malloc_Linux.c b/src/ext/OpenBSD_malloc_Linux.c
    index 855c912..cac1f50 100644
    a b  
    5858#include <limits.h>
    5959#include <errno.h>
    6060#include <err.h>
     61#include "crypto.h"
    6162/* For SIZE_MAX */
    6263#include "torint.h"
    63 
    6464//#include "thread_private.h"
    6565
    6666/*
    malloc_bytes(size_t size) 
    11881188        if (malloc_guard) {
    11891189                /* Walk to a random position. */
    11901190//              i = arc4random() % bp->free;
    1191                 i = rand() % bp->free;
     1191                i = crypto_rand_int_range(0, bp->free);
    11921192                while (i > 0) {
    11931193                        u += u;
    11941194                        k++;