From 834e4b079866594b50be64ae79f3cb2a5baa2070 Mon Sep 17 00:00:00 2001 From: Matthias Hopf Date: Tue, 28 Nov 2006 18:57:13 +0100 Subject: [PATCH] Fix potential NULL pointer access in timer code. https://bugzilla.novell.com/show_bug.cgi?id=223718 --- os/WaitFor.c | 16 +++++++++------- 1 file 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