fuzz_x509csr.c 512 B

12345678910111213141516171819202122
  1. #include <stdint.h>
  2. #include "mbedtls/x509_csr.h"
  3. int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
  4. #ifdef MBEDTLS_X509_CSR_PARSE_C
  5. int ret;
  6. mbedtls_x509_csr csr;
  7. unsigned char buf[4096];
  8. mbedtls_x509_csr_init( &csr );
  9. ret = mbedtls_x509_csr_parse( &csr, Data, Size );
  10. if (ret == 0) {
  11. ret = mbedtls_x509_csr_info( (char *) buf, sizeof( buf ) - 1, " ", &csr );
  12. }
  13. mbedtls_x509_csr_free( &csr );
  14. #else
  15. (void) Data;
  16. (void) Size;
  17. #endif
  18. return 0;
  19. }