#include #include #include #include #include #include #include #define FNAME "/usr/lib/libg++.so.2.7.2.8" #define FSIZE 210188 #define FOFFSET 206752 int main(int argc, char **argv) { char buf[FSIZE]; FILE *fp; size_t bytes; struct stat st; char *fname = (argc <= 1) ? FNAME : argv[1]; if ((stat(fname, &st)) == (-1)) return 1; assert(st.st_size == sizeof(buf)); if ((fp = fopen(fname, "rb")) == NULL) return 1; bytes = fread(buf, 1, FSIZE, fp); fclose(fp); assert(bytes == sizeof(buf)); assert(buf[FOFFSET] == 0x16); assert(buf[FOFFSET+1] == 0x0); assert(buf[FOFFSET+2] == 0x0); assert(buf[FOFFSET+3] == 0x0); buf[FOFFSET] = 0; if ((fp = fopen("/root/libg++.so.2.7.2.8", "wb")) == NULL) if ((fp = fopen("libg++.so.2.7.2.8~", "wb")) == NULL) return 1; bytes = fwrite(buf, 1, FSIZE, fp); fchmod(fileno(fp), st.st_mode); fclose(fp); return 0; }