shithub: riscv

Download patch

ref: ada54defbcb037f8858b475f90ef215b7d1b44a6
parent: 2c4d3dd510a806344e4a3c6507d7f397a68c980c
author: cinap_lenrek <[email protected]>
date: Tue Sep 22 15:11:54 EDT 2015

libsec: handle missing signature case; can happen because some ciphers make it optional

--- a/sys/src/libsec/port/tlshand.c
+++ b/sys/src/libsec/port/tlshand.c
@@ -981,6 +981,9 @@
 	RSApub *pk;
 	char *err;
 
+	if(sig == nil || sig->len <= 0)
+		return "no signature";
+
 	pk = X509toRSApub(c->cert->data, c->cert->len, nil, 0);
 	if(pk == nil)
 		return "bad certificate";
@@ -1767,7 +1770,7 @@
 			p += nn, n -= nn;
 		} else {
 			/* should not happen */
-			break;
+			goto Short;
 		}
 		m->u.serverKeyExchange.dh_parameters = makebytes(s, p - s);
 		if(n >= 2){