aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_cluster.c
diff options
context:
space:
mode:
authorGravatar Kostyantyn Hushchyn <kgushtin@op5.com> 2010-12-14 12:51:25 +0200
committerGravatar Jacob Hansen <jhansen@op5.com> 2018-11-29 16:37:59 +0100
commit910894a4e255cdb88e37f17a06f1393853544b84 (patch)
tree43abff5844d286cff6e12ac8994fd2dd7f763980 /plugins/check_cluster.c
parentc285edd2f34582c954a720317c3feba37aa1a33a (diff)
downloadmonitoring-plugins-910894a4e255cdb88e37f17a06f1393853544b84.tar.gz
check_cluster.c: Added data argument validation.
Signed-off-by: Kostyantyn Hushchyn <kgushtin@op5.com>
Diffstat (limited to 'plugins/check_cluster.c')
-rw-r--r--plugins/check_cluster.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/check_cluster.c b/plugins/check_cluster.c
index b86e501d..e1ede9f7 100644
--- a/plugins/check_cluster.c
+++ b/plugins/check_cluster.c
@@ -143,6 +143,7 @@ int main(int argc, char **argv){
int process_arguments(int argc, char **argv){
int c;
+ char *ptr;
int option=0;
static struct option longopts[]={
{"data", required_argument,0,'d'},
@@ -188,6 +189,15 @@ int process_arguments(int argc, char **argv){
case 'd': /* data values */
data_vals=(char *)strdup(optarg);
+ /* validate data */
+ for (ptr=data_vals;ptr!=NULL;ptr+=2){
+ if (ptr[0]<'0' || ptr[0]>'3')
+ return ERROR;
+ if (ptr[1]=='\0')
+ break;
+ if (ptr[1]!=',')
+ return ERROR;
+ }
break;
case 'l': /* text label */