2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

mnc: avoid sprintf based stackoverflow

This commit is contained in:
Helmut Grohne 2013-02-10 08:58:16 +01:00
parent af04bfead6
commit 34b87128de

View File

@ -90,7 +90,7 @@ int main(int argc, char *argv[]) {
continue;
}
sprintf(cmdline, "%s/%s", plugin_dir, plugin_filename);
snprintf(cmdline, LINE_MAX, "%s/%s", plugin_dir, plugin_filename);
if (access(cmdline, X_OK) == 0) {
printf("%s ", plugin_filename);
}
@ -107,7 +107,7 @@ int main(int argc, char *argv[]) {
printf("# unknown plugin: %s\n", arg);
continue;
}
sprintf(cmdline, "exec %s/%s %s", plugin_dir, arg, cmd);
snprintf(cmdline, LINE_MAX, "exec %s/%s %s", plugin_dir, arg, cmd);
system(cmdline);
printf(".\n");
} else if (strcmp(cmd, "cap") == 0) {