1
0
mirror of https://github.com/coturn/coturn.git synced 2025-08-15 10:47:05 +02:00
coturn/fuzzing/FuzzStunClient.c
Arjun dda0c99759
fuzzing support (#982)
Adding fuzzing to finding memory-corruption-related bugs.

Hello coturn team,
Can you check this pr harness suite for creating harnesses and compiling
harnesses?
Any other thoughts on adding a new interface for fuzzing support ?


Signed-off-by: 0x34d <ajsinghyadav00@gmail.com>

Signed-off-by: 0x34d <ajsinghyadav00@gmail.com>
2022-10-24 22:01:58 +02:00

35 lines
708 B
C

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "ns_turn_utils.h"
#include "apputils.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;
}