Browse Source

fix certificate blob parsing vulnerability by using blob_parse_untrusted

blob_parse expects blobs from trusted inputs, but in this case it can be
supplied with possibly malicious certificates from untrusted inputs as
well, so in order to prevent such conditions, switch to
blob_parse_untrusted which should hopefully handle such inputs
appropriately.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
Petr Štetiar 4 years ago
parent
commit
14a279411c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      ucert.c

+ 1 - 1
ucert.c

@@ -154,7 +154,7 @@ static int cert_load(const char *certfile, struct list_head *chain) {
 
 
 	bufpt = (struct blob_attr *)filebuf;
 	bufpt = (struct blob_attr *)filebuf;
 	do {
 	do {
-		pret = blob_parse(bufpt, certtb, cert_policy, CERT_ATTR_MAX);
+		pret = blob_parse_untrusted(bufpt, len, certtb, cert_policy, CERT_ATTR_MAX);
 		if (pret <= 0)
 		if (pret <= 0)
 			/* no attributes found */
 			/* no attributes found */
 			break;
 			break;