diff --git a/fuzz/cert.cc b/fuzz/cert.cc index 4078c0ec..e813ed56 100644 --- a/fuzz/cert.cc +++ b/fuzz/cert.cc @@ -1,11 +1,17 @@ +#include #include extern "C" int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len) { const uint8_t *bufp = buf; X509 *x509 = d2i_X509(NULL, &bufp, len); if (x509 != NULL) { - /* Also extract the public key. */ + /* Extract the public key. */ EVP_PKEY_free(X509_get_pubkey(x509)); + + /* Reserialize the structure. */ + uint8_t *der = NULL; + i2d_X509(x509, &der); + OPENSSL_free(der); } X509_free(x509); return 0;