Index: /branches/rel_apv_10_7_3/usr/click/bin/backend/ntp.c
===================================================================
--- /branches/rel_apv_10_7_3/usr/click/bin/backend/ntp.c	(revision 40136)
+++ /branches/rel_apv_10_7_3/usr/click/bin/backend/ntp.c	(working copy)
@@ -65,9 +65,9 @@
 
     while (fgets(linebuf, sizeof(linebuf), fp)) {
         if (strncmp(linebuf, prefix, strlen(prefix)) == 0 &&
-            (linebuf[strlen(prefix)] == '\0' || 
-             linebuf[strlen(prefix)] == ' ' || 
-             linebuf[strlen(prefix)] == '\n')) {
+                (linebuf[strlen(prefix)] == '\0' || 
+                 linebuf[strlen(prefix)] == ' ' || 
+                 linebuf[strlen(prefix)] == '\n')) {
             found = 1;
             continue;
         } else {
@@ -156,8 +156,8 @@
 
     while (fgets(linebuf, sizeof(linebuf), fp)) {
         if (strncmp(linebuf, "#", 1) && 
-            strncmp(linebuf, id_str, strlen(id_str)) == 0 &&
-            linebuf[strlen(id_str)] == ' ') {
+                strncmp(linebuf, id_str, strlen(id_str)) == 0 &&
+                linebuf[strlen(id_str)] == ' ') {
             found = 1;
             continue;
         } else {
@@ -251,9 +251,9 @@
 
     while (fgets(linebuf, sizeof(linebuf), fp)) {
         if (strncmp(linebuf, prefix, strlen(prefix)) == 0 &&
-            (linebuf[strlen(prefix)] == '\0' || 
-             linebuf[strlen(prefix)] == ' ' || 
-             linebuf[strlen(prefix)] == '\n')) {
+                (linebuf[strlen(prefix)] == '\0' || 
+                 linebuf[strlen(prefix)] == ' ' || 
+                 linebuf[strlen(prefix)] == '\n')) {
             continue;
         } else {
             fputs(linebuf, fp_tmp);
@@ -395,6 +395,12 @@
         snprintf(srv_config, sizeof(srv_config), "server %s %s", host, option);
     }
 
+    //Key Validation
+    if(key_id < NTP_MIN_AUTH_KEY_ID || key_id > NTP_MAX_AUTH_KEY_ID)
+    {
+        return -1;
+    }
+
     /* Append the key if key_id is provided */
     if(key_id) {
         snprintf(srv_config + strlen(srv_config), sizeof(srv_config) - strlen(srv_config), " key %d", key_id);
