nihonium
/
mipt_clang
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

23 lines
626 B
C

3 years ago
#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;
}