mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-05-28 04:35:40 -04:00
Fixed segfault in argument processing. Thanks to Christoph Schell (#1742066)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1757 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
06372d2d91
commit
c134205981
2 changed files with 9 additions and 4 deletions
|
|
@ -221,3 +221,4 @@ Emil Michles
|
|||
Ask Bjoern Hansen
|
||||
Daniel Bimschas
|
||||
Aurelien Bompard
|
||||
Christoph Schell
|
||||
|
|
|
|||
|
|
@ -582,22 +582,26 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
case 'C': /* commands */
|
||||
if (ncommands >= command_size) {
|
||||
commands = realloc (commands, command_size+8);
|
||||
command_size+=8;
|
||||
commands = realloc (commands, sizeof(char *) * command_size);
|
||||
if (commands == NULL)
|
||||
die (STATE_UNKNOWN,
|
||||
_("Could not realloc() units [%d]\n"), ncommands);
|
||||
}
|
||||
commands[ncommands] = optarg;
|
||||
commands[ncommands] = (char *) malloc (sizeof(char) * 255);
|
||||
strncpy (commands[ncommands], optarg, 255);
|
||||
ncommands++;
|
||||
break;
|
||||
case 'R': /* server responses */
|
||||
if (nresponses >= response_size) {
|
||||
responses = realloc (responses, response_size+8);
|
||||
response_size += 8;
|
||||
responses = realloc (responses, sizeof(char *) * response_size);
|
||||
if (responses == NULL)
|
||||
die (STATE_UNKNOWN,
|
||||
_("Could not realloc() units [%d]\n"), nresponses);
|
||||
}
|
||||
responses[nresponses] = optarg;
|
||||
responses[nresponses] = (char *) malloc (sizeof(char) * 255);
|
||||
strncpy (responses[nresponses], optarg, 255);
|
||||
nresponses++;
|
||||
break;
|
||||
case 'c': /* critical time threshold */
|
||||
|
|
|
|||
Loading…
Reference in a new issue