aboutsummaryrefslogtreecommitdiffstats
path: root/testing/openscap/xinetd_probe.patch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/openscap/xinetd_probe.patch')
-rw-r--r--testing/openscap/xinetd_probe.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/testing/openscap/xinetd_probe.patch b/testing/openscap/xinetd_probe.patch
new file mode 100644
index 0000000000..367f804dca
--- /dev/null
+++ b/testing/openscap/xinetd_probe.patch
@@ -0,0 +1,31 @@
+diff --git a/src/OVAL/probes/unix/xinetd_probe.c b/src/OVAL/probes/unix/xinetd_probe.c
+index 965d8cd04..e911ecc29 100644
+--- a/src/OVAL/probes/unix/xinetd_probe.c
++++ b/src/OVAL/probes/unix/xinetd_probe.c
+@@ -1298,6 +1298,7 @@ int op_merge_u16(void *dst, void *src, int type)
+
+ int op_assign_str(void *var, char *val)
+ {
++ char *strend = NULL;
+ if (var == NULL) {
+ return -1;
+ }
+@@ -1306,7 +1307,16 @@ int op_assign_str(void *var, char *val)
+ while(isspace(*val)) ++val;
+
+ if (*val != '\0') {
+- *((char **)(var)) = strdup(val);
++ strend = strrchr(val, '\0');
++ /* strip trailing whitespaces */
++ do {
++ strend--;
++ } while(isspace(*strend));
++ if((strend-val) < 0) {
++ dE("Error stripping white space from string '%s'", val);
++ return (-1);
++ }
++ *((char **)(var)) = strndup(val, (strend-val+1));
+ return (0);
+ } else
+ return (-1);
+