[openssh-commits] [openssh] 01/02: upstream: check key and IV length received in privsep state

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Jun 30 10:16:17 AEST 2026


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

djm pushed a commit to branch master
in repository openssh.

commit fa447bd5836f6d1c742c543207a3a6ec2909da75
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Tue Jun 30 00:09:01 2026 +0000

    upstream: check key and IV length received in privsep state
    
    transfer exactly match the expected sizes for the selected cipher; partially
    redundant to similar checks in cipher_init(), but nice to be more exact.
    
    GHPR from jmestwa-coder; ok dtucker@
    
    OpenBSD-Commit-ID: d4a9deef194cc44189e835ac59b7b800b9b5c281
---
 packet.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/packet.c b/packet.c
index 8d8f73ca0..4c89e60c5 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.338 2026/05/31 04:44:38 djm Exp $ */
+/* $OpenBSD: packet.c,v 1.339 2026/06/30 00:09:01 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -2548,6 +2548,11 @@ newkeys_from_blob(struct sshbuf *m, struct ssh *ssh, int mode)
 		r = SSH_ERR_INVALID_FORMAT;
 		goto out;
 	}
+	if (keylen != cipher_keylen(enc->cipher) ||
+	    ivlen != cipher_ivlen(enc->cipher)) {
+		r = SSH_ERR_INVALID_FORMAT;
+		goto out;
+	}
 	if (cipher_authlen(enc->cipher) == 0) {
 		if ((r = sshbuf_get_cstring(b, &mac->name, NULL)) != 0)
 			goto out;

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


More information about the openssh-commits mailing list