[openssh-commits] [openssh] 02/04: Limit the number of PAM environment variables.

git+noreply at mindrot.org git+noreply at mindrot.org
Thu Mar 9 18:33:29 AEDT 2023


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit bfd1ad01d974a316b60622759ad17537fa2d92b4
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Thu Mar 9 18:24:54 2023 +1100

    Limit the number of PAM environment variables.
    
    xcalloc has its own limits, but these are specific to PAM.  From
    Coverity CID 405198, ok djm@
---
 monitor.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/monitor.c b/monitor.c
index f856c873..fda4a366 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1097,6 +1097,10 @@ mm_answer_pam_respond(struct ssh *ssh, int sock, struct sshbuf *m)
 	sshpam_authok = NULL;
 	if ((r = sshbuf_get_u32(m, &num)) != 0)
 		fatal("%s: buffer error: %s", __func__, ssh_err(r));
+	if (num > PAM_MAX_NUM_MSG) {
+		fatal_f("Too many PAM messages, got %u, expected <= %u",
+		    num, (unsigned)PAM_MAX_NUM_MSG);
+	}
 	if (num > 0) {
 		resp = xcalloc(num, sizeof(char *));
 		for (i = 0; i < num; ++i) {

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list