Further refactored code and dealt with the verifier issues with string comparisons

This commit is contained in:
h3xduck
2021-11-24 12:17:31 -05:00
parent 0568d5192d
commit 74cc7ff9e5
10 changed files with 311 additions and 231 deletions

View File

@@ -27,6 +27,13 @@ static __always_inline int tcp_header_bound_check(struct tcphdr* tcp, void* data
return 0; //OK
}
static __always_inline int tcp_payload_bound_check(char* payload, int payload_size, void* data_end){
if ((void *)payload + payload_size > data_end){
return -1;
}
return 0; //OK
}
/* UTILITIES */
@@ -44,4 +51,8 @@ static __always_inline int get_protocol(void* data){
}
}
static __always_inline unsigned char* get_payload(struct tcphdr *tcp){
return (void *)tcp + tcp->doff*4;
}
#endif