]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2211] findbcastinter(): possibly undefined variable iface used.
authorDave Hart <hart@ntp.org>
Sat, 9 Jun 2012 14:16:49 +0000 (14:16 +0000)
committerDave Hart <hart@ntp.org>
Sat, 9 Jun 2012 14:16:49 +0000 (14:16 +0000)
[Bug 2220] Incorrect check for maximum association id in ntpq.

bk: 4fd35ad1MHv9AWdluR-SOQxudKS2iw

ChangeLog
ntpd/ntp_io.c
ntpq/ntpq.c

index 80c3c38ec49e15b7a0a498f0d3ec892cd047a253..baef0c426abc9073b7d89e640860c5a443ed9632 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
+* [Bug 2211] findbcastinter(): possibly undefined variable iface used.
+* [Bug 2220] Incorrect check for maximum association id in ntpq.
 (4.2.7p278) 2012/06/03 Released by Harlan Stenn <stenn@ntp.org>
+* [Bug 2204] [Bug 2204] Build with --enable-getifaddrs=glibc fails.
 * [Bug 2178] refclock_tsyncpci.c reach register fails to shift.
 * [Bug 2191] dcfd -Y y2kcheck on CentOS 6.2 x86_64 breaks make check.
 (4.2.7p277) 2012/05/25 Released by Harlan Stenn <stenn@ntp.org>
index a3f8e1cd0358df5ad2dfce0878be83a6a1622229..9df2f271b7556608a0fb3f64c66649635cbe930c 100644 (file)
@@ -3887,10 +3887,10 @@ findbcastinter(
        sockaddr_u *addr
        )
 {
+       endpt * iface;
+
+       iface = NULL;
 #if !defined(MPE) && (defined(SIOCGIFCONF) || defined(SYS_WINNT))
-       struct interface *iface;
-       
-       
        DPRINTF(4, ("Finding broadcast/multicast interface for addr %s in list of addresses\n",
                    stoa(addr)));
 
@@ -3973,9 +3973,11 @@ findbcastinter(
                DPRINTF(4, ("No bcast interface found for %s\n",
                            stoa(addr)));
                iface = ANY_INTERFACE_CHOOSE(addr);
-       } else
+       } else {
                DPRINTF(4, ("Found bcast-/mcast- interface index #%d %s\n",
                            iface->ifnum, iface->name));
+       }
+
        return iface;
 }
 
index 71686664ced9b0648c140f7d336ba39345880316..0474b2f565c9888fa0eef228394c1d7369e2b18a 100644 (file)
@@ -1580,18 +1580,20 @@ getarg(
                if ('&' == str[0]) {
                        if (!atouint(&str[1], &ul)) {
                                fprintf(stderr,
-                                       "***Association value `%s' invalid/undecodable\n",
+                                       "***Association index `%s' invalid/undecodable\n",
                                        str);
                                return 0;
                        }
-                       if (0 == numassoc)
+                       if (0 == numassoc) {
                                dogetassoc(stdout);
-                       if (ul > numassoc) {
-                               fprintf(stderr,
-                                       "***Association for `%s' unknown (max &%d)\n",
-                                       str, numassoc);
-                               return 0;
+                               if (0 == numassoc) {
+                                       fprintf(stderr,
+                                               "***No associations found, `%s' unknown\n",
+                                               str);
+                                       return 0;
+                               }
                        }
+                       ul = min(ul, numassoc);
                        argp->uval = assoc_cache[ul - 1].assid;
                        break;
                }