Răsfoiți Sursa

snmpstats: fix param type checking

- parameter type is given from definition of params not from modparam
  value type, resulting in mismatches for parameters that have
  USE_FUNC_PARAM flag set
- reported by Santiago Gimeno
(cherry picked from commit 9cf36478222aaf573a6cd7b65e6a4fd6227eb8cd)
Daniel-Constantin Mierla 15 ani în urmă
părinte
comite
e40bd16e6d
2 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 1 1
      modules_k/snmpstats/snmpObjects.c
  2. 1 1
      modules_k/snmpstats/utilities.c

+ 1 - 1
modules_k/snmpstats/snmpObjects.c

@@ -611,7 +611,7 @@ static int set_if_valid_threshold(modparam_t type, void *val, char *varStr,
 		return -1;
 		return -1;
 	}
 	}
 
 
-	if (type != INT_PARAM) {
+	if (PARAM_TYPE_MASK(type) != INT_PARAM) {
 		LM_ERR("%s called with type %d instead of %d!\n",
 		LM_ERR("%s called with type %d instead of %d!\n",
 				varStr, type, INT_PARAM);
 				varStr, type, INT_PARAM);
 		return -1;
 		return -1;

+ 1 - 1
modules_k/snmpstats/utilities.c

@@ -78,7 +78,7 @@ int stringHandlerSanityCheck( modparam_t type, void *val, char *parameterName)
 	char *theString = (char *)val;
 	char *theString = (char *)val;
 
 
 	/* Make sure the function was called correctly. */
 	/* Make sure the function was called correctly. */
-	if (type != STR_PARAM) {
+	if (PARAM_TYPE_MASK(type) != STR_PARAM) {
 		LM_ERR("the %s parameter was assigned a type %d instead of %d\n",
 		LM_ERR("the %s parameter was assigned a type %d instead of %d\n",
 				parameterName, type, STR_PARAM);
 				parameterName, type, STR_PARAM);
 		return 0;
 		return 0;