FuzzStunClient.c 708 B

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