Browse Source

Update goodbyedpi.c

pull/319/head
SashaXser 2 years ago
committed by GitHub
parent
commit
b259a82144
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/goodbyedpi.c

6
src/goodbyedpi.c

@ -428,11 +428,13 @@ static inline void change_window_size(const PWINDIVERT_TCPHDR ppTcpHdr, unsigned
/* HTTP method end without trailing space */ /* HTTP method end without trailing space */
static PVOID find_http_method_end(const char *pkt, unsigned int http_frag, int *is_fragmented) { static PVOID find_http_method_end(const char *pkt, unsigned int http_frag, int *is_fragmented) {
unsigned int i; unsigned int i;
unsigned int pkt_length = strlen(pkt);
for (i = 0; i<(sizeof(http_methods) / sizeof(*http_methods)); i++) { for (i = 0; i<(sizeof(http_methods) / sizeof(*http_methods)); i++) {
unsigned int method_length = strlen(http_methods[i]); unsigned int method_length = strlen(http_methods[i]);
if (memcmp(pkt, http_methods[i], method_length) == 0) { if (memcmp(pkt, http_methods[i], method_length) == 0) {
if (is_fragmented) if (is_fragmented)
*is_fragmented = 0; *is_fragmented = 0;
if (method_length - 1 <= pkt_length)
return (char*)pkt + method_length - 1; return (char*)pkt + method_length - 1;
} }
/* Try to find HTTP method in a second part of fragmented packet */ /* Try to find HTTP method in a second part of fragmented packet */
@ -443,14 +445,16 @@ static PVOID find_http_method_end(const char *pkt, unsigned int http_frag, int *
{ {
if (is_fragmented) if (is_fragmented)
*is_fragmented = 1; *is_fragmented = 1;
if (method_length - http_frag - 1 <= pkt_length)
return (char*)pkt + method_length - http_frag - 1; return (char*)pkt + method_length - http_frag - 1;
} }
} }
return (char*)pkt; return NULL;
} }
/** Fragment and send the packet. /** Fragment and send the packet.
* *
* This function cuts off the end of the packet (step=0) or * This function cuts off the end of the packet (step=0) or

Loading…
Cancel
Save