diff --git a/src/XCCDF/profile.c b/src/XCCDF/profile.c
index 115434032f0..a50b838aca7 100644
--- a/src/XCCDF/profile.c
+++ b/src/XCCDF/profile.c
@@ -287,14 +287,15 @@ struct xccdf_item *xccdf_profile_parse(xmlTextReaderPtr reader, struct xccdf_ite
}
case XCCDFE_SET_VALUE:{
oscap_list_add(prof->sub.profile.setvalues, xccdf_setvalue_new_parse(reader));
+ xmlTextReaderRead(reader);
break;
}
default:
if (!xccdf_item_process_element(prof, reader))
dW("Encountered an unknown element '%s' while parsing XCCDF profile.",
xmlTextReaderConstLocalName(reader));
+ xmlTextReaderRead(reader);
}
- xmlTextReaderRead(reader);
}
return prof;
diff --git a/tests/API/XCCDF/unittests/CMakeLists.txt b/tests/API/XCCDF/unittests/CMakeLists.txt
index a1c7da67ff4..c9c507791ce 100644
--- a/tests/API/XCCDF/unittests/CMakeLists.txt
+++ b/tests/API/XCCDF/unittests/CMakeLists.txt
@@ -106,3 +106,5 @@ add_oscap_test("test_generate_fix_ansible_vars.sh")
add_oscap_test("test_xccdf_requires_conflicts.sh")
add_oscap_test("test_results_hostname.sh")
add_oscap_test("test_skip_rule.sh")
+add_oscap_test("test_no_newline_between_select_elements.sh")
+add_oscap_test("test_single_line_tailoring.sh")
diff --git a/tests/API/XCCDF/unittests/test_no_newline_between_select_elements.sh b/tests/API/XCCDF/unittests/test_no_newline_between_select_elements.sh
new file mode 100755
index 00000000000..59b38e78ae1
--- /dev/null
+++ b/tests/API/XCCDF/unittests/test_no_newline_between_select_elements.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+. $builddir/tests/test_common.sh
+
+set -e
+set -o pipefail
+
+stdout=$(mktemp)
+
+$OSCAP xccdf eval --progress --profile "xccdf_com.example.www_profile_test" "$srcdir/test_no_newline_between_select_elements.xml" > "$stdout" || true
+
+# test if both rules selected in the profile were evaluated
+grep -q "xccdf_com.example.www_rule_first:pass" "$stdout"
+grep -q "xccdf_com.example.www_rule_second:fail" "$stdout"
+
+rm -f "$stdout"
diff --git a/tests/API/XCCDF/unittests/test_no_newline_between_select_elements.xml b/tests/API/XCCDF/unittests/test_no_newline_between_select_elements.xml
new file mode 100644
index 00000000000..ad8eaa95b4c
--- /dev/null
+++ b/tests/API/XCCDF/unittests/test_no_newline_between_select_elements.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ accepted
+ 1.0
+
+ xccdf_test_profile
+ This profile is for testing.
+
+
+
+ This rule always pass
+
+
+
+
+
+ This rule always fails
+
+
+
+
+
+
+
+
+
+ 5.11
+ 2009-01-12T10:41:00-05:00
+
+
+
+
+ PASS
+ pass
+
+
+
+
+
+
+
+ PASS
+ pass
+
+
+
+
+
+
+
+
+
+
+
+
+
+ oval:x:var:1
+
+
+
+
+ 100
+
+
+
+
+
diff --git a/tests/API/XCCDF/unittests/test_single_line_tailoring.sh b/tests/API/XCCDF/unittests/test_single_line_tailoring.sh
new file mode 100755
index 00000000000..9e0f5a6c96a
--- /dev/null
+++ b/tests/API/XCCDF/unittests/test_single_line_tailoring.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+. $builddir/tests/test_common.sh
+
+set -e
+set -o pipefail
+
+result=$(mktemp)
+
+$OSCAP xccdf eval --profile "xccdf_com.example.www_profile_custom" --results "$result" --tailoring-file "$srcdir/test_single_line_tailoring.tailoring.xml" "$srcdir/test_single_line_tailoring.xml"
+
+assert_exists 1 '//rule-result[@idref="xccdf_com.example.www_rule_R1"]/result[text()="pass"]'
+assert_exists 1 '//rule-result[@idref="xccdf_com.example.www_rule_R2"]/result[text()="notselected"]'
+assert_exists 1 '//rule-result[@idref="xccdf_com.example.www_rule_R3"]/result[text()="notselected"]'
+assert_exists 1 '//rule-result[@idref="xccdf_com.example.www_rule_R4"]/result[text()="notselected"]'
+
+rm -f "$result"
diff --git a/tests/API/XCCDF/unittests/test_single_line_tailoring.tailoring.xml b/tests/API/XCCDF/unittests/test_single_line_tailoring.tailoring.xml
new file mode 100644
index 00000000000..3bada781428
--- /dev/null
+++ b/tests/API/XCCDF/unittests/test_single_line_tailoring.tailoring.xml
@@ -0,0 +1 @@
+1
diff --git a/tests/API/XCCDF/unittests/test_single_line_tailoring.xml b/tests/API/XCCDF/unittests/test_single_line_tailoring.xml
new file mode 100644
index 00000000000..a9e112a8717
--- /dev/null
+++ b/tests/API/XCCDF/unittests/test_single_line_tailoring.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5.11.2
+ 2021-02-01T08:07:06+01:00
+
+
+
+
+ PASS
+ pass
+
+
+
+
+
+
+
+
+
+
+
+
+
+ oval:x:var:1
+
+
+
+
+ 100
+
+
+
+
+
+
+ accepted
+ Test Benchmark
+ Description
+ 1.0
+
+ OpenSCAP
+ OpenSCAP
+ OpenSCAP
+ http://scap.nist.gov
+
+
+ xccdf_test_profile
+ This profile is for testing.
+
+
+
+
+
+
+ Rule R1
+ Description
+
+
+
+
+
+ Rule R2
+ Description
+
+
+
+
+
+ Rule R3
+ Description
+
+
+
+
+
+ Rule R4
+ Description
+
+
+
+
+
+
+