diff options
author | Matthias Hopf <mhopf@suse.de> | 2006-11-28 18:57:13 +0100 |
---|---|---|
committer | Matthias Hopf <mhopf@suse.de> | 2006-11-28 18:58:18 +0100 |
commit | 834e4b079866594b50be64ae79f3cb2a5baa2070 (patch) | |
tree | 84968fa28c68bd38c6821cea1587f78664fe3e56 /os/WaitFor.c | |
parent | 5dbcd34a0a6c0d10dbfea8fdc9d7dfe7a0261b19 (diff) |
Fix potential NULL pointer access in timer code.
https://bugzilla.novell.com/show_bug.cgi?id=223718
Diffstat (limited to 'os/WaitFor.c')
-rw-r--r-- | os/WaitFor.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/os/WaitFor.c b/os/WaitFor.c index 6109e3477..ba227a3b6 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -205,15 +205,17 @@ WaitForSomething(int *pClientsReady) if (timeout > 0 && timeout > timers->delta + 250) { /* time has rewound. reset the timers. */ CheckAllTimers(now); - timeout = timers->expires - now; } - if (timeout < 0) - timeout = 0; - waittime.tv_sec = timeout / MILLI_PER_SECOND; - waittime.tv_usec = (timeout % MILLI_PER_SECOND) * - (1000000 / MILLI_PER_SECOND); - wt = &waittime; + if (timers) { + timeout = timers->expires - now; + if (timeout < 0) + timeout = 0; + waittime.tv_sec = timeout / MILLI_PER_SECOND; + waittime.tv_usec = (timeout % MILLI_PER_SECOND) * + (1000000 / MILLI_PER_SECOND); + wt = &waittime; + } } XFD_COPYSET(&AllSockets, &LastSelectMask); #ifdef SMART_SCHEDULE |