From 34b87128dead40b82f4d06e4cff089fe3090d633 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 10 Feb 2013 08:58:16 +0100 Subject: [PATCH] mnc: avoid sprintf based stackoverflow --- tools/munin-node-c/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/munin-node-c/main.c b/tools/munin-node-c/main.c index 08d4080a..4299f04a 100644 --- a/tools/munin-node-c/main.c +++ b/tools/munin-node-c/main.c @@ -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) {