diff --git a/src/apache.c b/src/apache.c
index 7667f247604b330ace7f4426aef9d659a139c05c..4fa7aa1b11a9f8dbf192271abfe65322be0e3806 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
static size_t apache_curl_callback (void *buf, size_t size, size_t nmemb,
- void *stream)
+ void __attribute__((unused)) *stream)
{
size_t len = size * nmemb;
status = ssnprintf (credentials, sizeof (credentials), "%s:%s",
user, (pass == NULL) ? "" : pass);
- if (status >= sizeof (credentials))
+ if ((status < 0) || ((size_t) status >= sizeof (credentials)))
{
ERROR ("apache plugin: init: Returning an error "
"because the credentials have been "
vl.values = values;
vl.values_len = 1;
- vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "apache");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "apache", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_instance != NULL)
vl.values = values;
vl.values_len = 1;
- vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "apache");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "apache", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_instance != NULL)