Last active
May 8, 2020 13:47
-
-
Save gamemann/9f0d42c25151d0f2e1630840d04fd599 to your computer and use it in GitHub Desktop.
Payload matching attempt via goto.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Payload match. | |
if (filter[i]->payloadLen > 0) | |
{ | |
// Initialize packet data. | |
for (uint16_t j = 0; j < MAX_PCKT_LENGTH; j++) | |
{ | |
if ((j + 1) > filter[i]->payloadLen) | |
{ | |
break; | |
} | |
uint8_t *byte = data + sizeof(struct ethhdr) + (iph->ihl * 4) + l4headerLen + j; | |
if (byte + 1 > (uint8_t *)data_end) | |
{ | |
break; | |
} | |
if (*(byte) == filter[i]->payloadMatch[j]) | |
{ | |
continue; | |
} | |
goto test; | |
} | |
continue; | |
} | |
test: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment