[prev in list] [next in list] [prev in thread] [next in thread]
List: ntp-hackers
Subject: [ntp:hackers] small patch for ntpq
From: John Hay <jhay () icomtek ! csir ! co ! za>
Date: 2001-11-25 8:57:26
[Download RAW message or body]
I found an of-by-one error in ntpq in the ipv6 tree and also found that at
least on my FreeBSD box ai->ai_canonname can be NULL sometimes. Here is a
fix for that.
Harlan, it is also in my repo on pogo.
John
--
John Hay -- John.Hay@icomtek.csir.co.za
===== ntpq/ntpq.c 1.20 vs 1.21 =====
--- 1.20/ntpq/ntpq.c Fri Nov 9 20:23:41 2001
+++ 1.21/ntpq/ntpq.c Thu Nov 15 19:25:09 2001
@@ -611,9 +611,15 @@
printf("%s\n", gai_strerror(a_info));
exit(-1);
}
- else {
+
+ if (ai->ai_canonname == NULL) {
+ strncpy(temphost, stoa((struct sockaddr_storage *)ai->ai_addr),
+ LENHOSTNAME);
+ temphost[LENHOSTNAME-1] = '\0';
+
+ } else {
strncpy(temphost, ai->ai_canonname, LENHOSTNAME);
- temphost[LENHOSTNAME] = '\0';
+ temphost[LENHOSTNAME-1] = '\0';
}
if (debug > 2)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic