]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Check for max value of skips before adding
authorDanny Mayer <mayer@ntp.org>
Tue, 8 Mar 2005 04:18:40 +0000 (23:18 -0500)
committerDanny Mayer <mayer@ntp.org>
Tue, 8 Mar 2005 04:18:40 +0000 (23:18 -0500)
bk: 422d27a0pMWdbQFO8gJiabtlhxauvA

ntpd/ntp_io.c

index 2614657761e09c757e388c3e5a98fbfca3d8e01c..1a1ef67e07155f4a3fff9b931343f0926e940e7f 100644 (file)
@@ -1924,7 +1924,7 @@ input_handler(
                                                packets_dropped++;
                                                if (buflen > 0)
                                                        nonzeroreads++;
-                                               else
+                                               else if (totskips < MAXSKIPS)
                                                {
                                                        skiplist[totskips] = fd;
                                                        totskips++;
@@ -1946,13 +1946,16 @@ input_handler(
                                                        netsyslog(LOG_ERR, "clock read fd %d: %m", fd);
                                                }
                                                freerecvbuf(rb);
-                                               skiplist[totskips] = fd;
-                                               totskips++;
+                                               if (totskips < MAXSKIPS)
+                                               {
+                                                       skiplist[totskips] = fd;
+                                                       totskips++;
+                                               }
                                                continue;
                                        }
                                        if(buflen > 0)
                                                nonzeroreads++;
-                                       else
+                                       else if (totskips < MAXSKIPS)
                                        {
                                                skiplist[totskips] = fd;
                                                totskips++;