]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Fix warnings in ntp_request.c ([Bug 1973] oversight) and sntp/main.c
authorDave Hart <hart@ntp.org>
Wed, 27 Jul 2011 22:42:23 +0000 (22:42 +0000)
committerDave Hart <hart@ntp.org>
Wed, 27 Jul 2011 22:42:23 +0000 (22:42 +0000)
  (CID 159, apparent overrun due to union, actually correct).

bk: 4e30944fz4icyT7_qSiqtrhutRIChw

ChangeLog
ntpd/ntp_request.c
sntp/main.c
sntp/networking.c
sntp/networking.h

index b6aedb02e6e337e2cfd2b0f03c53b646063812c1..2a6b4208a5331f08e293b9bc6eb81df47e6823f9 100644 (file)
--- 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 <stenn@ntp.org>
 * DEFAULT INSTALLATION DIRECTORY CHANGES ON SOME OSes: to get the old
   behavior, pass --with-locfile=legacy to 'configure'
index c6beb57c9d876b6ff7c1446f2e5ad57f8698c99a..54bd940b3ad8855777bb80c1290afbad1135f857 100644 (file)
@@ -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));
index 6d314387efa3ed2e9886e8aa275a4fab04204811..e65c9bbe25bc49b9f9665c014250a825e8e3f4fd 100644 (file)
@@ -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;
index 7fea4df0031133b1d3eb2e808d48a5cb4c22fbcc..6cf02bae062191e47eecaf5ffefb25de502c9d55 100644 (file)
@@ -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;
index d2d0665598042c3dd427757b3cc4477592826c3e..35c03108b548082bb10b044f01d01f2bdd165c3e 100644 (file)
@@ -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);