s3:nmbd: Fix possible integer overflow
authorAndreas Schneider <asn@samba.org>
Thu, 7 Dec 2017 14:24:59 +0000 (15:24 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 20 Mar 2018 22:16:16 +0000 (23:16 +0100)
This fixes compilation with -Wstrict-overflow=2

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/nmbd/nmbd_sendannounce.c

index 1d557c4..44d67e7 100644 (file)
@@ -288,8 +288,10 @@ void announce_my_server_names(time_t t)
                        }
 
                        /* Announce every minute at first then progress to every 12 mins */
-                       if ((t - work->lastannounce_time) < work->announce_interval)
+                       if (t > work->lastannounce_time &&
+                           (t - work->lastannounce_time) < work->announce_interval) {
                                continue;
+                       }
 
                        if (work->announce_interval < (CHECK_TIME_MAX_HOST_ANNCE * 60))
                                work->announce_interval += 60;