[Date Prev]   [Date Next] [Thread Prev]   [Thread Next] [Date Index]   [Thread Index]


     [snips-users] Bug in ntpmon.c?

I've recently changed jobs, and in trying to install snips at my new
location, I believe that I've found a bug in ntpmon.c

When I run ntpmon (as distributed), it fails on the read that tries to read
the packet coming back from the ntp server.  In comparing the snips version
to the last nocol version, I found that you've added a couple of bzero lines
which clean out the struct hostaddr; unfortunately, they're both after the
address is inserted into the hostaddr. Putting the bzero ahead of the
get_inet_address seems to fix the problem.  Here are diffs:

    <   bzero((char *)&hostaddr, sizeof(hostaddr));
    <     /* bzero((char *)&hostaddr, sizeof(hostaddr)); */
    >     bzero((char *)&hostaddr, sizeof(hostaddr));
    <   /* bzero((char *)&hostaddr, sizeof(hostaddr)); */
    >   bzero((char *)&hostaddr, sizeof(hostaddr));

If I read the code right, the bzero I inserted before the get_inet_address
call is unnecessary, since get_inet_address does it internally, but I did
put it there, since you'd put them into the routine...

mikeV <m vevea at seafloor.com>

Zyrion Traverse Network Monitoring & Network Management Software