1
0

FuzzStunClient.c 689 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include "apputils.h"
  5. #include "ns_turn_utils.h"
  6. #include "stun_buffer.h"
  7. #define kMinInputLength 10
  8. #define kMaxInputLength 5120
  9. extern int LLVMFuzzerTestOneInput(const uint8_t *Data,
  10. size_t Size) { // stunclient.c
  11. if (Size < kMinInputLength || Size > kMaxInputLength) {
  12. return 1;
  13. }
  14. stun_buffer buf;
  15. buf.len = Size;
  16. memcpy(buf.buf, Data, buf.len);
  17. if (stun_is_command_message(&buf)) {
  18. if (stun_is_response(&buf)) {
  19. if (stun_is_success_response(&buf)) {
  20. if (stun_is_binding_response(&buf)) {
  21. return 0;
  22. }
  23. }
  24. }
  25. }
  26. return 1;
  27. }