1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

ctdb-locking: Don't pass NULL to tevent_req_is_unix_error()

If there is an error then this pointer is unconditionally
dereferenced.

However, the only possible error appears to be ENOMEM, where a crash
caused by dereferencing a NULL pointer isn't a terrible outcome.  In
the absence of a security issue this is probably not worth
backporting.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2022-01-21 12:14:05 +11:00 committed by Amitay Isaacs
parent 490e5f4d4c
commit d52b497d11

View File

@ -230,9 +230,9 @@ static void wait_for_parent_check(struct tevent_req *subreq)
tevent_req_set_callback(subreq, wait_for_parent_check, req);
}
static bool wait_for_parent_recv(struct tevent_req *req)
static bool wait_for_parent_recv(struct tevent_req *req, int *perr)
{
if (tevent_req_is_unix_error(req, NULL)) {
if (tevent_req_is_unix_error(req, perr)) {
return false;
}
@ -273,6 +273,7 @@ int main(int argc, char *argv[])
int ppid;
const char *lock_type;
bool status;
int err;
reset_scheduler();
@ -336,9 +337,11 @@ int main(int argc, char *argv[])
tevent_req_poll(req, ev);
status = wait_for_parent_recv(req);
status = wait_for_parent_recv(req, &err);
if (! status) {
fprintf(stderr, "locking: wait_for_parent_recv() failed\n");
fprintf(stderr,
"locking: wait_for_parent_recv() failed (%d)\n",
err);
}
talloc_free(ev);