mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
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
This commit is contained in:
@@ -830,7 +830,7 @@ long int ast_random(void)
|
||||
if (dev_urandom_fd >= 0) {
|
||||
int read_res = read(dev_urandom_fd, &res, sizeof(res));
|
||||
if (read_res > 0)
|
||||
return res;
|
||||
return labs(res);
|
||||
}
|
||||
#endif
|
||||
#ifdef linux
|
||||
|
Reference in New Issue
Block a user