Compare commits
No commits in common. "ae40d1a4339a753c2e8a6c3056eb922b7bcd16af" and "7b390ba2a3ec96585b181cf3b5782797c9492cd4" have entirely different histories.
ae40d1a433
...
7b390ba2a3
|
@ -428,27 +428,22 @@ static inline void change_window_size(const PWINDIVERT_TCPHDR ppTcpHdr, unsigned
|
|||
/* HTTP method end without trailing space */
|
||||
static PVOID find_http_method_end(const char *pkt, unsigned int http_frag, int *is_fragmented) {
|
||||
unsigned int i;
|
||||
unsigned int pkt_length = strlen(pkt);
|
||||
for (i = 0; i<(sizeof(http_methods) / sizeof(*http_methods)); i++) {
|
||||
unsigned int method_length = strlen(http_methods[i]);
|
||||
if (memcmp(pkt, http_methods[i], method_length) == 0) {
|
||||
if (is_fragmented)
|
||||
*is_fragmented = 0;
|
||||
char *end = strchr(pkt + method_length, ' ');
|
||||
if (end != NULL && end - pkt <= pkt_length)
|
||||
return end;
|
||||
return (char*)pkt + method_length - 1;
|
||||
}
|
||||
/* Try to find HTTP method in a second part of fragmented packet */
|
||||
if ((http_frag == 1 || http_frag == 2) &&
|
||||
memcmp(pkt, http_methods[i] + http_frag,
|
||||
method_length - http_frag) == 0
|
||||
method_length - http_frag) == 0
|
||||
)
|
||||
{
|
||||
if (is_fragmented)
|
||||
*is_fragmented = 1;
|
||||
char *end = strchr(pkt + method_length - http_frag, ' ');
|
||||
if (end != NULL && end - pkt <= pkt_length)
|
||||
return end;
|
||||
return (char*)pkt + method_length - http_frag - 1;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
@ -456,7 +451,6 @@ static PVOID find_http_method_end(const char *pkt, unsigned int http_frag, int *
|
|||
|
||||
|
||||
|
||||
|
||||
/** Fragment and send the packet.
|
||||
*
|
||||
* This function cuts off the end of the packet (step=0) or
|
||||
|
@ -813,17 +807,15 @@ int main(int argc, char *argv[]) {
|
|||
char *autottl_copy = strdup(optarg);
|
||||
if (strchr(autottl_copy, '-')) {
|
||||
// token "-" found, start X-Y parser
|
||||
char *autottl_current;
|
||||
char *saveptr; // declare a pointer to store the state of strtok_r
|
||||
autottl_current = strtok_r(autottl_copy, "-", &saveptr);
|
||||
char *autottl_current = strtok(autottl_copy, "-");
|
||||
auto_ttl_1 = atoub(autottl_current, "Set Auto TTL parameter error!");
|
||||
autottl_current = strtok_r(NULL, "-", &saveptr);
|
||||
autottl_current = strtok(NULL, "-");
|
||||
if (!autottl_current) {
|
||||
puts("Set Auto TTL parameter error!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
auto_ttl_2 = atoub(autottl_current, "Set Auto TTL parameter error!");
|
||||
autottl_current = strtok_r(NULL, "-", &saveptr);
|
||||
autottl_current = strtok(NULL, "-");
|
||||
if (!autottl_current) {
|
||||
puts("Set Auto TTL parameter error!");
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
Loading…
Reference in New Issue