shithub: riscv

Download patch

ref: 2c4d3dd510a806344e4a3c6507d7f397a68c980c
parent: c3e1c158f62458f16e5b538f188bad14844d277d
author: cinap_lenrek <[email protected]>
date: Tue Sep 22 14:39:48 EDT 2015

libsec: make sure Elem is zero initialized so freevalfields() wont cause accidents

--- a/sys/src/libsec/port/x509.c
+++ b/sys/src/libsec/port/x509.c
@@ -2213,6 +2213,7 @@
 	char *err;
 
 	el = nil;
+	memset(&e, 0, sizeof(e));
 	buflen = pkcs1decryptsignature(sig, siglen, pk, &buf);
 	if(buflen < 0 || decode(buf, buflen, &e) != ASN_OK || !is_seq(&e, &el) || elistlen(el) != 2 ||
 			!is_octetstring(&el->tl->hd, &digest)) {