]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 798] ntpq [p typo crashes ntpq
authorHarlan Stenn <stenn@ntp.org>
Sat, 17 Mar 2007 09:53:50 +0000 (04:53 -0500)
committerHarlan Stenn <stenn@ntp.org>
Sat, 17 Mar 2007 09:53:50 +0000 (04:53 -0500)
bk: 45fbbaaeI5ZowcVlY9P-CI5a9_Mb8w

ChangeLog
ntpq/ntpq.c

index e27aaa52b45fc6e4fdd544592cc053cd373f6f9d..9a3877ecd1a6845c110f06eae8d3eb77cfba38ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 798] ntpq [p typo crashes ntpq.
 * [Bug 786] Fix refclock_bancomm.c on Solaris.
 * [Bug 789] Fix multicast client crypto authentication.
 * [Bug 774] parsesolaris.c does not compile under the new Solaris.
index 41192f4bf090ed84418f50904e3bdc165005a8f3..23e0bef7ab27fe51148efb34262cca353ab8fa29 100644 (file)
@@ -662,12 +662,16 @@ openhost(
        
        cp = hname;
        
-       if(*cp == '[') {
+       if (*cp == '[') {
                cp++;
-               for(i = 0; *cp != ']'; cp++, i++)
+               for (i = 0; *cp && *cp != ']'; cp++, i++)
                        name[i] = *cp;
-       name[i] = '\0';
-       hname = name;
+               if (*cp == ']') {
+                       name[i] = '\0';
+                       hname = name;
+               } else {
+                       return 0;
+               }
        }
 
        /*