r14229: Something Coverity hasn't caught (yet) but I've gotten
authorJeremy Allison <jra@samba.org>
Sun, 12 Mar 2006 04:18:43 +0000 (04:18 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:18 +0000 (11:15 -0500)
sensitive to null derefs. get_timed_events_timeout()
can potentially return NULL. Cope with this.
Jeremy.
(This used to be commit 04838078723613628b298b7a87622df30432cf64)

source3/smbd/process.c

index a50323887a695ad0d8b881d0963ca9d0a1ec89d0..40d6818f3f059e264e1e2648be2d80268bc85698 100644 (file)
@@ -445,9 +445,11 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
                struct timeval tmp;
                struct timeval *tp = get_timed_events_timeout(&tmp,SMBD_SELECT_TIMEOUT);
 
-               to = timeval_min(&to, tp);
-               if (timeval_is_zero(&to)) {
-                       return True;
+               if (tp) {
+                       to = timeval_min(&to, tp);
+                       if (timeval_is_zero(&to)) {
+                               return True;
+                       }
                }
        }