Skip to content
Snippets Groups Projects
Commit 3ed2deb7 authored by Russell Bryant's avatar Russell Bryant
Browse files

Ensure that the read from /dev/urandom returns a positive result

(closes issue #10308, reported by yehavi, patched by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 7a97d499
Branches
Tags
No related merge requests found
...@@ -830,7 +830,7 @@ long int ast_random(void) ...@@ -830,7 +830,7 @@ long int ast_random(void)
if (dev_urandom_fd >= 0) { if (dev_urandom_fd >= 0) {
int read_res = read(dev_urandom_fd, &res, sizeof(res)); int read_res = read(dev_urandom_fd, &res, sizeof(res));
if (read_res > 0) if (read_res > 0)
return res; return labs(res);
} }
#endif #endif
#ifdef linux #ifdef linux
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment