Sanity check an ASN1_object_size result

If it's negative don't try and malloc it.

Reviewed-by: Tim Hudson <tjh@openssl.org>
This commit is contained in:
Matt Caswell
2016-08-23 00:19:15 +01:00
parent b197257d71
commit a36c5eabf5
+2
View File
@@ -373,6 +373,8 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
}
/* Work out total size */
j = ASN1_object_size(0, i, V_ASN1_OBJECT);
if (j < 0)
return NULL;
if ((buf = OPENSSL_malloc(j)) == NULL)
return NULL;