Question: The program we provide: - Takes as a command - line argument the name of a file, which it opens. - The program then asks

The program we provide:- Takes as a command-line argument the name of a file, which it opens.- The program then asks your function (`your_fcn()`) for a string, writes that string to the file, and closes the file.- It then re-opens the file, and attempts to "sanitize" the string you provided by removing all instances of the substring "`414`" from it.- Finally, it overwrites the file with this "sanitized" version of the string.For example, if your function generated the string "I love CMSC414!" thenwe would get the following output:```cmsc414@cmsc414:~$ ./task0a.x file.txtcmsc414@cmsc414:~$ cat file.txtI love CMSC!```**Your goal is to write `your_fcn()` in such a way that the file whose name isprovided on the command-line still has the substring "`414`" in it.**A simple way to test for this is with the command `grep 414` which returns linescontaining the string "`414`" as follows:```cmsc414@cmsc414:~$ grep 414 file.txt```If this returns nothing (as the above case would), then that means the filedoes not have "`414`" in it, resulting in no credit.**you must provide a*functionally unique* solution in each of the three**; they cannot simply beslight variations of one another (e.g., if one of your solutions was`printf(x)` then another cannot be `puts(x)` as those are functionally the samething).There are many different ways to solve this! Some might involve bufferoverflows, and some might not. We are not requiring any one particularsolution; just like with any attack, what matters is whether it achievesthe goal, even if it's not a method we anticipated. *Be creative* and have funwith it!Here's a working example:int your_func(char* your_string){ strcpy(your_string, "441414"); return 0;}Here's the function that removes the string:char *strremove(char *str, const char *sub){ size_t len = strlen(sub); if (len >0){ char *p = str; while ((p = strstr(p, sub))!= NULL){ memmove(p, p + len, strlen(p + len)+1); }} return str;}Rewrite your_func(char* your_string) at least in 2 different ways that will cause 414 to still be in file.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!