aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_cluster.c
diff options
context:
space:
mode:
authorGravatar Sven Nierlein <sven@nierlein.org> 2018-12-07 17:35:58 +0100
committerGravatar GitHub <noreply@github.com> 2018-12-07 17:35:58 +0100
commitac6f101f057caa3083c092537e6dff97328cfd44 (patch)
treefb70fda138265fb14793729146ae55270d1f04d2 /plugins/check_cluster.c
parentc7c4be2ad1fa97d5b8db0cff5f7204c605992047 (diff)
parent910894a4e255cdb88e37f17a06f1393853544b84 (diff)
downloadmonitoring-plugins-ac6f101f057caa3083c092537e6dff97328cfd44.tar.gz
Merge pull request #1564 from jacobbaungard/check_cluster_arg_validation
check_cluster.c: Added data argument validation.
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 */