Projects
Factory:RISC-V:Base
libxslt
_service:tar_scm:CVE-2015-9019.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:CVE-2015-9019.patch of Package libxslt
diff --git a/libexslt/math.c b/libexslt/math.c index 17138b2..c9f9e5a 100644 --- a/libexslt/math.c +++ b/libexslt/math.c @@ -11,6 +11,13 @@ #include <math.h> #include <stdlib.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <fcntl.h> +#ifdef HAVE_TIME_H +#include <time.h> +#endif #include "exslt.h" @@ -460,6 +467,20 @@ static double exsltMathRandom (void) { double ret; int num; + long seed; + static int randinit = 0; + + if (!randinit) { + int fd = open("/dev/urandom",O_RDONLY); + + seed = time(NULL); /* just in case /dev/urandom is not there */ + if (fd == -1) { + read (fd, &seed, sizeof(seed)); + close (fd); + } + srand(seed); + randinit = 1; + } num = rand(); ret = (double)num / (double)RAND_MAX; -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2