components/openscap/patches/oval_variable_fix.patch
branchs11-update
changeset 4343 df06342a3259
parent 4340 729452029ab0
child 4346 bcf2c636e551
equal deleted inserted replaced
4340:729452029ab0 4343:df06342a3259
     1 This patch fixes the issue when variables are used in XCCDF
       
     2 and the selector value is outside the specified list of values
       
     3 for the variable, prevents oscap from dumping core.
       
     4 This patch does not need to be contributed upstream, as it is 
       
     5 from the upstream community.
       
     6 This patch is based on https://github.com/OpenSCAP/openscap/commit/dd94c23cfafbd1ad0d316ccf4fa9489af4c68c74
       
     7 This patch will not be needed once we upgrade to 1.2.2 or higher.
       
     8 --- openscap-1.2.1/src/XCCDF_POLICY/xccdf_policy.c.~1~	2015-03-13 10:26:12.158240726 -0700
       
     9 +++ openscap-1.2.1/src/XCCDF_POLICY/xccdf_policy.c	2015-03-13 10:28:36.287476734 -0700
       
    10 @@ -2166,7 +2166,13 @@
       
    11  	}
       
    12  
       
    13  	struct xccdf_value_instance *instance = xccdf_value_get_instance_by_selector((struct xccdf_value *) item, selector);
       
    14 -	return xccdf_value_instance_get_value(instance);
       
    15 +	if (instance == NULL) {
       
    16 +	    oscap_seterr(OSCAP_EFAMILY_XCCDF, "Invalid selector '%s' for xccdf:value/@id='%s'. Using null value instead.",
       
    17 +	                    selector, xccdf_value_get_id((struct xccdf_value *) item));
       
    18 +		return NULL;
       
    19 +	} else {
       
    20 +		return xccdf_value_instance_get_value(instance);
       
    21 +	}
       
    22  }
       
    23  
       
    24  static int xccdf_policy_get_refine_value_oper(struct xccdf_policy * policy, struct xccdf_item * item)