X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnginx.c;h=4de59f3752b8827f28bf8885ec2f3c9073dd6c5d;hb=5f9ec13b946733ff4e1edf2d8e3b7a22311dd894;hp=a95362be4f7fd58a29cf3d2db610b0f4f4e71e48;hpb=2354eda94fa44c8bcb8e39b24b117e7937110224;p=collectd.git diff --git a/src/nginx.c b/src/nginx.c index a95362be..4de59f37 100644 --- a/src/nginx.c +++ b/src/nginx.c @@ -122,7 +122,8 @@ static int init (void) if (user != NULL) { - if (snprintf (credentials, 1024, "%s:%s", user, pass == NULL ? "" : pass) >= 1024) + if (ssnprintf (credentials, sizeof (credentials), + "%s:%s", user, pass == NULL ? "" : pass) >= sizeof (credentials)) { ERROR ("nginx plugin: Credentials would have been truncated."); return (-1); @@ -180,13 +181,10 @@ static void submit (char *type, char *inst, long long value) strcpy (vl.host, hostname_g); strcpy (vl.plugin, "nginx"); strcpy (vl.plugin_instance, ""); - strncpy (vl.type, type, sizeof (vl.type)); + sstrncpy (vl.type, type, sizeof (vl.type)); if (inst != NULL) - { - strncpy (vl.type_instance, inst, sizeof (vl.type_instance)); - vl.type_instance[sizeof (vl.type_instance) - 1] = '\0'; - } + sstrncpy (vl.type_instance, inst, sizeof (vl.type_instance)); plugin_dispatch_values (&vl); } /* void submit */