From: Dave Hart Date: Sat, 9 Jun 2012 14:16:49 +0000 (+0000) Subject: [Bug 2211] findbcastinter(): possibly undefined variable iface used. X-Git-Tag: NTP_4_2_7P279~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fc9f90ee4081a9f4b2010c2d72f554f16410289;p=thirdparty%2Fntp.git [Bug 2211] findbcastinter(): possibly undefined variable iface used. [Bug 2220] Incorrect check for maximum association id in ntpq. bk: 4fd35ad1MHv9AWdluR-SOQxudKS2iw --- diff --git a/ChangeLog b/ChangeLog index 80c3c38ec..baef0c426 100644 --- 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 +* [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 diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index a3f8e1cd0..9df2f271b 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -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; } diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c index 71686664c..0474b2f56 100644 --- a/ntpq/ntpq.c +++ b/ntpq/ntpq.c @@ -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; }