FuzzStun.c 748 B

1234567891011121314151617181920212223242526272829
  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. static SHATYPE shatype = SHATYPE_SHA1;
  8. #define kMinInputLength 10
  9. #define kMaxInputLength 5120
  10. extern int LLVMFuzzerTestOneInput(const uint8_t *Data,
  11. size_t Size) { // rfc5769check
  12. if (Size < kMinInputLength || Size > kMaxInputLength) {
  13. return 1;
  14. }
  15. stun_is_command_message_full_check_str((uint8_t *)Data, Size, 1, NULL);
  16. uint8_t uname[33];
  17. uint8_t realm[33];
  18. uint8_t upwd[33];
  19. strcpy((char *)upwd, "VOkJxbRl1RmTxUk/WvJxBt");
  20. stun_check_message_integrity_str(TURN_CREDENTIALS_SHORT_TERM, (uint8_t *)Data, Size, uname, realm, upwd, shatype);
  21. return 0;
  22. }