xauth-pam: Properly initialize response array when handling sessions

This is documented as a requirement in the man page, so the caller of the
conversation function might expect such an array.  Although, since we
only accept non-interactive requests, for which no response is expected,
it's doubtful whether it will actually try to access elements in the
array.  And if the passed pointer was initialized to NULL, passing it to
free() is probably also fine.

Fixes: 2312504d1e ("xauth-pam: Open/close a PAM session for each connected client")
This commit is contained in:
Tobias Brunner
2026-07-24 08:47:36 +02:00
parent 66f0f3a599
commit be4b9f4aaa
@@ -65,7 +65,8 @@ static int conv(int num_msg, const struct pam_message **msg,
return PAM_CONV_ERR;
}
}
return PAM_SUCCESS;
*resp = calloc(num_msg, sizeof(struct pam_response));
return (*resp || !num_msg) ? PAM_SUCCESS : PAM_BUF_ERR;
}
METHOD(listener_t, ike_updown, bool,