Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save XMPPwocky/ccc990d2b349d798717176041f9e7111 to your computer and use it in GitHub Desktop.
Save XMPPwocky/ccc990d2b349d798717176041f9e7111 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
void main() {
const char *code = (const char *)main;
int oldcount = -1;
while (1) {
int count = 0;
const char *temp = code;
while (temp) {
// 0x100 bytes should be enough for anybody.
temp = (const char *)memchr(temp, 0xcc, 0x100);
if (temp) {
count++; temp++;
}
}
if (oldcount != count) {
if (oldcount == -1) oldcount = count;
else {
printf("%d\n", count);
break;
}
}
}
printf("breakpoint between\n");
printf("these\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment