privkey_fuzz.cc 366 B

12345678910111213141516171819202122
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. #include <stdint.h>
  4. extern "C" {
  5. #include "sshkey.h"
  6. #include "sshbuf.h"
  7. int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
  8. {
  9. struct sshkey *k = NULL;
  10. struct sshbuf *b = sshbuf_from(data, size);
  11. int r = sshkey_private_deserialize(b, &k);
  12. if (r == 0) sshkey_free(k);
  13. sshbuf_free(b);
  14. return 0;
  15. }
  16. } // extern