diff --git a/src/OVAL/probes/SEAP/seap-packet.c b/src/OVAL/probes/SEAP/seap-packet.c index bf07131cab..745008e889 100644 --- a/src/OVAL/probes/SEAP/seap-packet.c +++ b/src/OVAL/probes/SEAP/seap-packet.c @@ -48,7 +48,10 @@ SEAP_packet_t *SEAP_packet_new (void) void SEAP_packet_free (SEAP_packet_t *packet) { - free(packet); + if (packet != NULL) { + free(packet); + } + return; } void *SEAP_packet_settype (SEAP_packet_t *packet, uint8_t type) diff --git a/src/OVAL/probes/unix/routingtable_probe.c b/src/OVAL/probes/unix/routingtable_probe.c index ca511396ee..96d095a0f8 100644 --- a/src/OVAL/probes/unix/routingtable_probe.c +++ b/src/OVAL/probes/unix/routingtable_probe.c @@ -329,6 +329,14 @@ int routingtable_probe_main(probe_ctx *ctx, void *arg) switch(probe_ent_getdatatype(dst_ent)) { case OVAL_DATATYPE_IPV4ADDR: fp = fopen("/proc/net/route", "r"); + if (fp == NULL) { + if (errno == ENOENT) { + dI("/proc/net/route does not exist. No IPv4 routing table available."); + } else { + dE("Failed to open /proc/net/route: %s", strerror(errno)); + } + break; + } /* Skip the header line */ if (getline(&line_buf, &line_len, fp) != -1) { while(getline(&line_buf, &line_len, fp) != -1) { @@ -346,6 +354,14 @@ int routingtable_probe_main(probe_ctx *ctx, void *arg) break; case OVAL_DATATYPE_IPV6ADDR: fp = fopen("/proc/net/ipv6_route", "r"); + if (fp == NULL) { + if (errno == ENOENT) { + dI("/proc/net/route does not exist. No IPv4 routing table available."); + } else { + dE("Failed to open /proc/net/route: %s", strerror(errno)); + } + break; + } while(getline(&line_buf, &line_len, fp) != -1) { if (process_line_ip6(line_buf, &rt) != 0) diff --git a/src/OVAL/probes/unix/xinetd_probe.c b/src/OVAL/probes/unix/xinetd_probe.c index fcb9156250..88e7c5227e 100644 --- a/src/OVAL/probes/unix/xinetd_probe.c +++ b/src/OVAL/probes/unix/xinetd_probe.c @@ -1097,7 +1097,10 @@ int xiconf_parse_section(xiconf_t *xiconf, xiconf_file_t *xifile, int type, char if (scur->protocol == NULL) { struct servent *service = getservbyname(scur->name, NULL); dD("protocol is empty, trying to guess from /etc/services for %s", scur->name); - if (service != NULL) { + if (service == NULL) { + return -1; + } + else { scur->protocol = strdup(service->s_proto); dD("service %s has default protocol=%s", scur->name, scur->protocol); } @@ -1107,7 +1110,10 @@ int xiconf_parse_section(xiconf_t *xiconf, xiconf_file_t *xifile, int type, char if (scur->port == 0) { struct servent *service = getservbyname(scur->name, scur->protocol); dD("port not set, trying to guess from /etc/services for %s", scur->name); - if (service != NULL) { + if (service == NULL) { + return -1; + } + else { if (service->s_port > 0 && service->s_port < 65536) { scur->port = ntohs((uint16_t)service->s_port); dD("service %s has default port=%hu/%s", diff --git a/src/XCCDF/rule.c b/src/XCCDF/rule.c index 3f30a6961a..7dc49d9844 100644 --- a/src/XCCDF/rule.c +++ b/src/XCCDF/rule.c @@ -113,6 +113,7 @@ static bool xccdf_item_parse_deps(xmlTextReaderPtr reader, struct xccdf_item *it } if (reqs->itemcount == 0) { oscap_list_free(reqs, NULL); + free(idsstr); return false; }