rendered paste body#include <stdio.h>#include <stdlib.h>#include <string.h>int main(int argc, char *argv[], char *envp[]){ FILE * opt; FILE * dest; FILE * src; char * buffer_opt; int i = 0; long lSize; opt = fopen(argv[3], "r"); fseek(opt, 0, SEEK_END); lSize = ftell(opt); rewind(opt); buffer_opt = (char *)malloc(sizeof(char) * lSize); fread(buffer_opt,1,lSize,opt); fclose(opt); int rc = 0; while(rc != 4) { if(buffer_opt[i] == '\n') rc++; i++; } i += 11; lSize = i; while(buffer_opt[i] != '\n') i++; int path_len = i - lSize; strncpy(buffer_opt, buffer_opt, i); buffer_opt[i] = '\0'; char * buftmp = (char *)malloc(sizeof(char) * i); int buftmplen = i; while(i != 0) { buftmp[buftmplen-i] = buffer_opt[i-1]; i--; } buftmp[buftmplen] = '\0'; char *revpath = (char *)malloc(sizeof(char) * path_len); free(buffer_opt); strncpy(revpath, buftmp, path_len+1); revpath[path_len+1] = '\0'; free(buftmp); char * path = (char *)malloc(sizeof(char) * (path_len+1)); while(i != (path_len+1)) { path[i] = revpath[path_len-i]; i++; } path[i] = '\0'; free(revpath); strcat(path, "\\etc\\odin.cfg"); dest = fopen(path, "w+"); /* char * path_ = (char *)malloc(strlen(envp[31])); i=0; printf("%s\n", envp[31]); while(i != path_len || envp[31][strlen(envp[31])-i] != ';') { path_[i] = envp[31][strlen(envp[31])-i]; i++; } path_[i] = '\0'; char * path__ = (char *)malloc(strlen(path_)); while(i != 0) { path__[strlen(path_)-i] = path_[i]; i--; } path__[i] = '\0'; printf("%s\n", path__); */ char *filename = "odin.cfg"; src = fopen( filename, "r"); printf("%d\n", src); fseek(src, 0, SEEK_END); lSize = ftell(src); rewind(src); char * mem = (char *)malloc(lSize * sizeof(char)); fread(mem, 1, lSize, src); printf("%s\n", mem); fwrite(mem, 1, lSize, dest); fclose(dest); fclose(src); free(mem); free(path); return 0;}