tests: use blob_parse_untrusted variant

In order to be able to use invalid input for testing as well.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
Petr Štetiar 2019-12-09 14:47:40 +01:00
parent 0b24e24b93
commit 325418a7a3
2 changed files with 2 additions and 2 deletions

View file

@ -64,7 +64,7 @@ static void fuzz_blob_parse(const uint8_t *data, size_t size)
struct blob_attr *foo[__FOO_ATTR_MAX]; struct blob_attr *foo[__FOO_ATTR_MAX];
struct blob_attr *buf = (struct blob_attr *)data; struct blob_attr *buf = (struct blob_attr *)data;
blob_parse(buf, foo, foo_policy, __FOO_ATTR_MAX); blob_parse_untrusted(buf, size, foo, foo_policy, __FOO_ATTR_MAX);
} }
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)

View file

@ -87,7 +87,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;