1
0
mirror of https://github.com/coturn/coturn.git synced 2025-08-10 08:17:05 +02:00
coturn/fuzzing/FuzzStunClient.c
Gustavo Garcia d9108a4b54
Add clang format rules and checks (#935)
I would like to get feedback on this and see if people is confortable
with these clang rules.

Right now is using the "llvm" style increasing the line length from 80
to 120 given that coturn is using long lines often.

Co-authored-by: Pavel Punsky <eakraly@users.noreply.github.com>
2022-11-06 22:05:17 +01:00

36 lines
689 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "apputils.h"
#include "ns_turn_utils.h"
#include "stun_buffer.h"
#define kMinInputLength 10
#define kMaxInputLength 5120
extern int LLVMFuzzerTestOneInput(const uint8_t *Data,
size_t Size) { // stunclient.c
if (Size < kMinInputLength || Size > kMaxInputLength) {
return 1;
}
stun_buffer buf;
buf.len = Size;
memcpy(buf.buf, Data, buf.len);
if (stun_is_command_message(&buf)) {
if (stun_is_response(&buf)) {
if (stun_is_success_response(&buf)) {
if (stun_is_binding_response(&buf)) {
return 0;
}
}
}
}
return 1;
}