summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2002-09-26 02:17:45 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2002-09-26 02:17:45 (GMT)
commitfc5d208720b353f6d4e0e906ab2d93e115aa4ed9 (patch)
tree28102cabf34a20563a5f24a870db29a030c44caf
parentb198e9623a0f4129920700b46240e0f0e2c7a8f1 (diff)
downloadmonitoring-plugins-fc5d208720b353f6d4e0e906ab2d93e115aa4ed9.tar.gz
use ssprintf instead of sprintf
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@105 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/urlize.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/urlize.c b/plugins/urlize.c
index c04ac0e..9e02cb5 100644
--- a/plugins/urlize.c
+++ b/plugins/urlize.c
@@ -48,7 +48,7 @@ int
48main (int argc, char **argv) 48main (int argc, char **argv)
49{ 49{
50 int i = 0, found = 0, result = STATE_UNKNOWN; 50 int i = 0, found = 0, result = STATE_UNKNOWN;
51 char command_line[MAX_INPUT_BUFFER] = ""; 51 char *cmd = NULL;
52 char input_buffer[MAX_INPUT_BUFFER]; 52 char input_buffer[MAX_INPUT_BUFFER];
53 53
54 if (argc < 2) { 54 if (argc < 2) {
@@ -71,20 +71,20 @@ main (int argc, char **argv)
71 exit (STATE_UNKNOWN); 71 exit (STATE_UNKNOWN);
72 } 72 }
73 73
74 sprintf (command_line, "%s", argv[2]); 74 cmd = ssprintf (cmd, "%s", argv[2]);
75 for (i = 3; i < argc; i++) { 75 for (i = 3; i < argc; i++) {
76 sprintf (command_line, "%s %s", command_line, argv[i]); 76 cmd = ssprintf (cmd, "%s %s", cmd, argv[i]);
77 } 77 }
78 78
79 child_process = spopen (command_line); 79 child_process = spopen (cmd);
80 if (child_process == NULL) { 80 if (child_process == NULL) {
81 printf ("Could not open pipe: %s\n", command_line); 81 printf ("Could not open pipe: %s\n", cmd);
82 exit (STATE_UNKNOWN); 82 exit (STATE_UNKNOWN);
83 } 83 }
84 84
85 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 85 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
86 if (child_stderr == NULL) { 86 if (child_stderr == NULL) {
87 printf ("Could not open stderr for %s\n", command_line); 87 printf ("Could not open stderr for %s\n", cmd);
88 } 88 }
89 89
90 printf ("<A href=\"%s\">", argv[1]); 90 printf ("<A href=\"%s\">", argv[1]);
@@ -101,7 +101,7 @@ main (int argc, char **argv)
101 101
102 if (!found) { 102 if (!found) {
103 printf ("%s problem - No data recieved from host\nCMD: %s\n", argv[0], 103 printf ("%s problem - No data recieved from host\nCMD: %s\n", argv[0],
104 command_line); 104 cmd);
105 exit (STATE_UNKNOWN); 105 exit (STATE_UNKNOWN);
106 } 106 }
107 107