]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 798] ntpq [p typo crashes ntpdc
authorHarlan Stenn <stenn@ntp.org>
Sat, 17 Mar 2007 20:19:52 +0000 (15:19 -0500)
committerHarlan Stenn <stenn@ntp.org>
Sat, 17 Mar 2007 20:19:52 +0000 (15:19 -0500)
bk: 45fc4d68EPTSZNYHiGGCxqSI58JaUg

ChangeLog
ntpdc/ntpdc.c

index 5ec56005ed2db9042a8dbbc931e34544dad1e9ea..fa1851145472951032b278d9f823968b9e105751 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,5 @@
 * [Bug 795] Moved declaration of variable to top of function.
-* [Bug 798] ntpq [p typo crashes ntpq.
+* [Bug 798] ntpq [p typo crashes ntpq/ntpdc.
 * [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 d1c0301b9821ced0a0bf5f68bb0a92845d7979c1..347bb3f30707189d36068522d006cbd1c21a0b81 100644 (file)
@@ -499,10 +499,14 @@ openhost(
        
        if (*cp == '[') {
                cp++;   
-               for(i = 0; *cp != ']'; cp++, i++)
-                       name[i] = *cp;  
-               name[i] = '\0';
-               hname = name;
+               for (i = 0; *cp && *cp != ']'; cp++, i++)
+                       name[i] = *cp;
+               if (*cp == ']') {
+                       name[i] = '\0';
+                       hname = name;
+               } else {
+                       return 0;
+               }
        }       
 
        /*