-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: urcd action: commit revision: path_from: revision_from: c5dca8d93db6fbb11914d1fd75faefccb6d0a98c: path_to: revision_to:
commit c5dca8d93db6fbb11914d1fd75faefccb6d0a98c Author: root <root@localhost.(none)> Date: Sun Dec 14 01:09:02 2014 +0000 [liburc] randombytes use stack and heap (see comment) diff --git a/src/liburc.h b/src/liburc.h
--- a/src/liburc.h +++ b/src/liburc.h @@ -46,12 +46,14 @@ void randombytes(unsigned char *b, int blen) { if (devurandomfd == -1) devurandomfd = open("/dev/urandom",O_RDONLY); if (devurandomfd == -1) { unsigned char * a = malloc(256 * sizeof(unsigned char)); + unsigned char c[256]; /* sometimes heap is zeroed, try luck with stack */ struct timeval now; int i; for (i=0;i<blen;++i) { gettimeofday(&now,'\x00'); srand(now.tv_usec); b[i] = rand() & 255; + b[i] ^= c[i & 255]; if (a) b[i] ^= a[i & 255]; }if (a) free(a); } else read(devurandomfd,b,blen);
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 18:23:17 2024