[monitoring-plugins] check_cluster.c: Added data argument validation.
Jacob Hansen
git at monitoring-plugins.org
Fri Dec 7 17:40:18 CET 2018
Module: monitoring-plugins
Branch: master
Commit: 910894a4e255cdb88e37f17a06f1393853544b84
Author: Kostyantyn Hushchyn <kgushtin at op5.com>
Committer: Jacob Hansen <jhansen at op5.com>
Date: Tue Dec 14 12:51:25 2010 +0200
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=910894a
check_cluster.c: Added data argument validation.
Signed-off-by: Kostyantyn Hushchyn <kgushtin at op5.com>
---
plugins/check_cluster.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/plugins/check_cluster.c b/plugins/check_cluster.c
index b86e501..e1ede9f 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 */
More information about the Commits
mailing list