From: Dave Hart Date: Wed, 27 Jul 2011 22:42:23 +0000 (+0000) Subject: Fix warnings in ntp_request.c ([Bug 1973] oversight) and sntp/main.c X-Git-Tag: NTP_4_2_7P197~1^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39ea0912d421e47dee427c75bc5aa3003661632b;p=thirdparty%2Fntp.git Fix warnings in ntp_request.c ([Bug 1973] oversight) and sntp/main.c (CID 159, apparent overrun due to union, actually correct). bk: 4e30944fz4icyT7_qSiqtrhutRIChw --- diff --git a/ChangeLog b/ChangeLog index b6aedb02e..2a6b4208a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * [Bug 1976] genLocInfo writes to srcdir break 'make distcheck'. * Do not force "legacy" when --with-locfile is not given, genLocInfo will find the correct default for the system. +* Fix warnings in ntp_request.c ([Bug 1973] oversight) and sntp/main.c + (CID 159, apparent overrun due to union, actually correct). (4.2.7p196) 2011/07/27 Released by Harlan Stenn * DEFAULT INSTALLATION DIRECTORY CHANGES ON SOME OSes: to get the old behavior, pass --with-locfile=legacy to 'configure' diff --git a/ntpd/ntp_request.c b/ntpd/ntp_request.c index c6beb57c9..54bd940b3 100644 --- a/ntpd/ntp_request.c +++ b/ntpd/ntp_request.c @@ -910,7 +910,7 @@ peer_info ( ip->flash = (u_char)pp->flash; ip->flash2 = (u_short)pp->flash; ip->estbdelay = HTONS_FP(DTOFP(pp->delay)); - ip->ttl = pp->ttl; + ip->ttl = (u_char)pp->ttl; ip->associd = htons(pp->associd); ip->rootdelay = HTONS_FP(DTOUFP(pp->rootdelay)); ip->rootdispersion = HTONS_FP(DTOUFP(pp->rootdisp)); diff --git a/sntp/main.c b/sntp/main.c index 6d314387e..e65c9bbe2 100644 --- a/sntp/main.c +++ b/sntp/main.c @@ -819,7 +819,7 @@ sock_cb( } /* Read in the packet */ - rpktl = recvdata(fd, &sender, &rbuf.pkt, sizeof(rbuf)); + rpktl = recvdata(fd, &sender, &rbuf, sizeof(rbuf)); if (rpktl < 0) { msyslog(LOG_DEBUG, "recvfrom error %m"); return; diff --git a/sntp/networking.c b/sntp/networking.c index 7fea4df00..6cf02bae0 100644 --- a/sntp/networking.c +++ b/sntp/networking.c @@ -44,7 +44,7 @@ int recvdata( SOCKET rsock, sockaddr_u * sender, - struct pkt * rdata, + void * rdata, int rdata_length ) { @@ -52,14 +52,14 @@ recvdata( int recvc; slen = sizeof(*sender); - recvc = recvfrom(rsock, (void *)rdata, rdata_length, 0, + recvc = recvfrom(rsock, rdata, rdata_length, 0, &sender->sa, &slen); if (recvc < 0) return recvc; #ifdef DEBUG if (debug > 2) { printf("Received %d bytes from %s:\n", recvc, sptoa(sender)); - pkt_output(rdata, recvc, stdout); + pkt_output((struct pkt *)rdata, recvc, stdout); } #endif return recvc; diff --git a/sntp/networking.h b/sntp/networking.h index d2d066559..35c03108b 100644 --- a/sntp/networking.h +++ b/sntp/networking.h @@ -35,7 +35,7 @@ /* From ntpdate.c */ void sendpkt(SOCKET rsock, sockaddr_u *dest, struct pkt *pkt, int len); -int recvdata(SOCKET rsock, sockaddr_u *sender, struct pkt *rdata, +int recvdata(SOCKET rsock, sockaddr_u *sender, void *rdata, int rdata_len); int recvpkt(SOCKET rsock, struct pkt *rpkt, unsigned int rsize, struct pkt *spkt);