1
0
mirror of https://github.com/coturn/coturn.git synced 2025-08-10 08:17:05 +02:00
coturn/fuzzing/FuzzStun.c
Michael Jones da332ed9e7
Add the InsertBraces command for clang-format to ensure that all conditionals always have braces (#1408)
- Why? Because code where conditionals lack braces is much harder to read, and prone to indentation confusion.
- How? Just added an extra flag to .clang-format and re-ran clang-format on all the files.

I also moved .clang-format up to the top level of the repo so that it can be applied to the fuzz targets as well.
2024-01-27 16:38:40 -08:00

30 lines
748 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "apputils.h"
#include "ns_turn_utils.h"
#include "stun_buffer.h"
static SHATYPE shatype = SHATYPE_SHA1;
#define kMinInputLength 10
#define kMaxInputLength 5120
extern int LLVMFuzzerTestOneInput(const uint8_t *Data,
size_t Size) { // rfc5769check
if (Size < kMinInputLength || Size > kMaxInputLength) {
return 1;
}
stun_is_command_message_full_check_str((uint8_t *)Data, Size, 1, NULL);
uint8_t uname[33];
uint8_t realm[33];
uint8_t upwd[33];
strcpy((char *)upwd, "VOkJxbRl1RmTxUk/WvJxBt");
stun_check_message_integrity_str(TURN_CREDENTIALS_SHORT_TERM, (uint8_t *)Data, Size, uname, realm, upwd, shatype);
return 0;
}