[Initng-svn] r2358 - in initng: plugins/history plugins/iparser plugins/ngc2 plugins/reload plugins/splash plugins/syslog tools

svn at initng.thinktux.net svn at initng.thinktux.net
Wed Dec 7 09:39:43 CET 2005


Author: danne
Date: Wed Dec  7 09:39:41 2005
New Revision: 2358

Modified:
   initng/plugins/history/initng_history.c
   initng/plugins/iparser/initng_i_parser.c
   initng/plugins/ngc2/initng_ngc2.c
   initng/plugins/reload/initng_reload.c
   initng/plugins/splash/initng_splash.c
   initng/plugins/syslog/initng_syslog.c
   initng/tools/install_service.c
Log:
Bug 313. This time I commit it!


Modified: initng/plugins/history/initng_history.c
==============================================================================
--- initng/plugins/history/initng_history.c	(original)
+++ initng/plugins/history/initng_history.c	Wed Dec  7 09:39:41 2005
@@ -291,6 +291,8 @@
     history_h *current = NULL;
     active_row row;
 
+    memset(&row, 0, sizeof row);
+
     while_history_db_prev(current)
     {
         /* if action is not set, it is probably a string logged in this db */

Modified: initng/plugins/iparser/initng_i_parser.c
==============================================================================
--- initng/plugins/iparser/initng_i_parser.c	(original)
+++ initng/plugins/iparser/initng_i_parser.c	Wed Dec  7 09:39:41 2005
@@ -118,6 +118,8 @@
     /* calculate lenght to newline */
     len = strcspn(g_pointer, "\n");
 
+    if (len>100) len = 100;	/* TODO: really needed, or implicated by some constraints?? */
+
     /* fill the line, with a line with data */
     strncpy(line, g_pointer, len);
     line[len] = '\0';
@@ -670,6 +672,7 @@
         return (FALSE);
     }
     strncpy(opt_name, (*where), opt_len);
+    opt_name[opt_len] = '\0';
 
     /* walk */
     (*where) += opt_len;
@@ -1055,6 +1058,7 @@
 
     /* ok, copy the code */
     strncpy(to, *value, len);
+    to[len] = '\0';
 
     /* walk */
     (*value) += len;

Modified: initng/plugins/ngc2/initng_ngc2.c
==============================================================================
--- initng/plugins/ngc2/initng_ngc2.c	(original)
+++ initng/plugins/ngc2/initng_ngc2.c	Wed Dec  7 09:39:41 2005
@@ -129,6 +129,7 @@
     read_header header;
     int header_opt_len = 0;
 
+    memset(&result, 0, sizeof result);
     result.p_ver = PROTOCOL_VERSION;
 
     s_command *tmp_cmd;         /* temprary storage for a command */
@@ -407,6 +408,7 @@
 
     D_("Sending ping\n");
 
+    memset(&header, 0, sizeof header);
     header.p_ver = PROTOCOL_VERSION;
 
     /* Create the socket. */
@@ -638,6 +640,7 @@
     {
         help_row row;
 
+        memset(&row, 0, sizeof row);
         row.c = current->command_id;
         row.t = current->com_type;
         row.o = current->opt_type;
@@ -655,6 +658,8 @@
 {
     active_h *serv = NULL;
     active_row row;
+    
+    memset(&row, 0, sizeof row);
 
     /* argument required */
     if (!arg || strlen(arg) < 2)
@@ -703,6 +708,8 @@
     active_h *serv = NULL;
     active_row row;
 
+    memset(&row, 0, sizeof row);
+
     /* argument required */
     if (!arg || strlen(arg) < 2)
     {
@@ -753,7 +760,7 @@
     s_entry *current = NULL;
     option_row row;
 
-    row.n[0] = '\0';
+    memset(&row, 0, sizeof row);
 
     /* if an argument is provided */
     if (arg && strlen(arg) > 1)
@@ -782,12 +789,11 @@
 
     while_option_db(current)
     {
-        row.n[0] = '\0';
-        row.d[0] = '\0';
-
         if (!current->opt_name)
             continue;
 
+	row.d[0] = '\0';
+
         strncpy(row.n, current->opt_name, 100);
         if (current->opt_desc)
             strncpy(row.d, current->opt_desc, 300);
@@ -811,7 +817,7 @@
     active_h *current = NULL;
     active_row row;
 
-    row.s[0] = '\0';
+    memset(&row, 0, sizeof row);
 
     /* if an argument is provided */
     if (arg && strlen(arg) > 1)

Modified: initng/plugins/reload/initng_reload.c
==============================================================================
--- initng/plugins/reload/initng_reload.c	(original)
+++ initng/plugins/reload/initng_reload.c	Wed Dec  7 09:39:41 2005
@@ -225,6 +225,8 @@
             F_("Service name is to long, it won't fit the fileformat spec! max is %i, won't save this service!\n", MAX_SERVICE_NAME_STRING_LEN);
             continue;
         }
+
+        memset(&entry, 0, sizeof entry);
         strncpy(entry.name, current->name, MAX_SERVICE_NAME_STRING_LEN);
         strncpy(entry.state, current->a_state->state_name, 100);
         strncpy(entry.type, current->type->name, 100);

Modified: initng/plugins/splash/initng_splash.c
==============================================================================
--- initng/plugins/splash/initng_splash.c	(original)
+++ initng/plugins/splash/initng_splash.c	Wed Dec  7 09:39:41 2005
@@ -188,7 +188,8 @@
                 if (strncmp(service->name, "net/", 4) == 0)
                 {
                     strncpy(svc_name, service->name, 100);
-                    svc_name[3] = '.';
+		    svc_name[99] = '\0';
+                    svc_name[3]  = '.';
                 }
                 else
                 {
@@ -197,6 +198,7 @@
                     if (service->name[i])
                         i++;
                     strncpy(svc_name, service->name + i, 100);
+		    svc_name[99] = '\0';
                 }
 
                 if (service->a_state == &LOADING ||

Modified: initng/plugins/syslog/initng_syslog.c
==============================================================================
--- initng/plugins/syslog/initng_syslog.c	(original)
+++ initng/plugins/syslog/initng_syslog.c	Wed Dec  7 09:39:41 2005
@@ -227,7 +227,7 @@
 static void syslog_fetch_output(active_h * service, int datalen,
                                 process_h * process)
 {
-    char log[200];
+    char log[201];
     int pos = process->buffer_pos;
     int i;
 

Modified: initng/tools/install_service.c
==============================================================================
--- initng/tools/install_service.c	(original)
+++ initng/tools/install_service.c	Wed Dec  7 09:39:41 2005
@@ -372,6 +372,7 @@
     i = 0;
     while (path[i])
     {
+	memset(filename, 0, sizeof filename);
         strncpy(filename, path[i], FILENAME_LEN - 2);
         len = strlen(filename);
         if (filename[len - 1] != '/')


More information about the Initng-svn mailing list