nihonium
/
mipt_clang
Archived
1
0
Fork 0
master
nihonium 3 years ago
parent 00a1019ddc
commit bcf24631d4
No known key found for this signature in database
GPG Key ID: 0924047F4136012C

@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
#define N 75000
int main() {
unsigned char *buf = (unsigned char *)malloc(N * sizeof(char));
unsigned char check[4] = {0xd9, 0x45, 0x08, 0xd9};
size_t n = fread(buf, sizeof(char), N, stdin);
for(size_t i = 0; i < n - 3; i++){
if(buf[i] == check[0] && buf[i + 1] == check[1] && buf[i + 2] == check[2] && buf[i + 3] == check[3]) {
buf[i + 4] = 0xeb;
buf[i + 5] = 0x90;
buf[i + 6] = 0xd8;
buf[i + 7] = 0xc9;
break;
}
}
fwrite(buf, sizeof(char), n, stdout);
free(buf);
return 0;
}