sshsigopt_fuzz.cc 489 B

123456789101112131415161718192021222324252627282930
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. #include <stdint.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. extern "C" {
  7. #include "sshsig.h"
  8. int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
  9. {
  10. char *cp = (char *)malloc(size + 1);
  11. struct sshsigopt *opts = NULL;
  12. if (cp == NULL)
  13. goto out;
  14. memcpy(cp, data, size);
  15. cp[size] = '\0';
  16. if ((opts = sshsigopt_parse(cp, "libfuzzer", 0, NULL)) == NULL)
  17. goto out;
  18. out:
  19. free(cp);
  20. sshsigopt_free(opts);
  21. return 0;
  22. }
  23. } // extern "C"