Fix potential NULL pointer access in timer code.

https://bugzilla.novell.com/show_bug.cgi?id=223718
This commit is contained in:
Matthias Hopf 2006-11-28 18:57:13 +01:00
parent 5dbcd34a0a
commit 834e4b0798

View File

@ -205,15 +205,17 @@ WaitForSomething(int *pClientsReady)
if (timeout > 0 && timeout > timers->delta + 250) { if (timeout > 0 && timeout > timers->delta + 250) {
/* time has rewound. reset the timers. */ /* time has rewound. reset the timers. */
CheckAllTimers(now); CheckAllTimers(now);
timeout = timers->expires - now;
} }
if (timeout < 0) if (timers) {
timeout = 0; timeout = timers->expires - now;
waittime.tv_sec = timeout / MILLI_PER_SECOND; if (timeout < 0)
waittime.tv_usec = (timeout % MILLI_PER_SECOND) * timeout = 0;
(1000000 / MILLI_PER_SECOND); waittime.tv_sec = timeout / MILLI_PER_SECOND;
wt = &waittime; waittime.tv_usec = (timeout % MILLI_PER_SECOND) *
(1000000 / MILLI_PER_SECOND);
wt = &waittime;
}
} }
XFD_COPYSET(&AllSockets, &LastSelectMask); XFD_COPYSET(&AllSockets, &LastSelectMask);
#ifdef SMART_SCHEDULE #ifdef SMART_SCHEDULE