Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various issues reported by Coverity #2047

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/OVAL/oval_sexp.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,8 @@ static struct oval_sysitem *oval_sexp_to_sysitem(struct oval_syschar_model *mode
} else {
family = item_name;
char *endptr = strchr(family, ':');
if (endptr == NULL)
goto cleanup;
*endptr = '\0';
name = endptr + 1;
endptr = strrchr(name, '_');
Expand Down
6 changes: 3 additions & 3 deletions src/OVAL/probes/probe/worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,13 +1021,13 @@ SEXP_t *probe_worker(probe_t *probe, SEAP_msg_t *msg_in, int *ret)
dE("open(\".\") failed: %s", strerror(errno));
return NULL;
}
if (chdir(rootdir) != 0) {
dE("chdir failed: %s", strerror(errno));
}

if (chroot(rootdir) != 0) {
dE("chroot failed: %s", strerror(errno));
}
if (chdir("/") != 0) {
dE("chdir failed: %s", strerror(errno));
}
/* NOTE: We're running in a different root directory.
* Unless /proc, /sys are somehow emulated for the new
* environment, they are not relevant and so are other
Expand Down
4 changes: 4 additions & 0 deletions src/OVAL/probes/unix/linux/inetlisteningservers_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,10 @@ int inetlisteningservers_probe_main(probe_ctx *ctx, void *arg)

object = probe_ctx_getobject(ctx);
struct server_info *req = malloc(sizeof(struct server_info));
if (req == NULL)
return 0;
memset(req, 0, sizeof(*req));

req->protocol_ent = probe_obj_getent(object, "protocol", 1);
if (req->protocol_ent == NULL) {
err = PROBE_ENOVAL;
Expand Down
2 changes: 1 addition & 1 deletion src/OVAL/probes/unix/linux/rpmverifypackage_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ static int rpmverifypackage_additem(probe_ctx *ctx, struct rpmverify_res *res)
SEXP_free(value);
}
if (res->vflags & VERIFY_SCRIPT) {
dD("VERIFY_SCRIPT %d", res->vresults & VERIFY_SCRIPT);
dD("VERIFY_SCRIPT %lu", res->vresults & VERIFY_SCRIPT);
value = probe_entval_from_cstr(OVAL_DATATYPE_BOOLEAN, (res->vresults & VERIFY_SCRIPT ? "1" : "0"), 1);
probe_item_ent_add(item, "verification_script_successful", NULL, value);
SEXP_free(value);
Expand Down