mirror of
https://github.com/h3xduck/TripleCross.git
synced 2025-12-25 02:43:07 +08:00
Further refactored code and dealt with the verifier issues with string comparisons
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user