Bug 186201: should handle a null 'environ' pointer, which can happen on

Solaris if NSS is loaded with dlopen() by an executable linked with the
RTLD_GROUP flag.
This commit is contained in:
wtc%netscape.com 2003-01-09 04:34:31 +00:00
parent ec08fd394a
commit 22b938bb47

View File

@ -827,12 +827,14 @@ for the small amount of entropy it provides.
* execution environment of the user and on the platform the program
* is running on.
*/
cp = (const char * const *)environ;
while (*cp) {
RNG_RandomUpdate(*cp, strlen(*cp));
cp++;
if (environ != NULL) {
cp = environ;
while (*cp) {
RNG_RandomUpdate(*cp, strlen(*cp));
cp++;
}
RNG_RandomUpdate(environ, (char*)cp - (char*)environ);
}
RNG_RandomUpdate(environ, (char*)cp - (char*)environ);
/* Give in system information */
if (gethostname(buf, sizeof(buf)) > 0) {