diff --git a/src/processes.c b/src/processes.c
index 1b413725d1cfbb0a662eb23ed422d358c7fc7efd..8275022f1120df9bb2c55374eb97d6d96bc4aebc 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
if ((new = (procstat_t *) malloc (sizeof (procstat_t))) == NULL)
return;
memset (new, 0, sizeof (procstat_t));
- strncpy (new->name, name, PROCSTAT_NAME_LEN);
+ sstrncpy (new->name, name, sizeof (new->name));
for (ptr = list_head_g; ptr != NULL; ptr = ptr->next)
{
strcpy (vl.plugin, "processes");
strcpy (vl.plugin_instance, "");
strcpy (vl.type, "ps_state");
- strncpy (vl.type_instance, state, sizeof (vl.type_instance));
+ sstrncpy (vl.type_instance, state, sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
}
vl.time = time (NULL);
strcpy (vl.host, hostname_g);
strcpy (vl.plugin, "processes");
- strncpy (vl.plugin_instance, ps->name, sizeof (vl.plugin_instance));
+ sstrncpy (vl.plugin_instance, ps->name, sizeof (vl.plugin_instance));
strcpy (vl.type, "ps_rss");
vl.values[0].gauge = ps->vmem_rss;
DIR *dh;
struct dirent *ent;
- snprintf (dirname, 64, "/proc/%i/task", pid);
- dirname[63] = '\0';
+ ssnprintf (dirname, sizeof (dirname), "/proc/%i/task", pid);
if ((dh = opendir (dirname)) == NULL)
{
memset (ps, 0, sizeof (procstat_t));
- snprintf (filename, 64, "/proc/%i/stat", pid);
- filename[63] = '\0';
+ ssnprintf (filename, sizeof (filename), "/proc/%i/stat", pid);
if ((fh = fopen (filename, "r")) == NULL)
return (-1);