Question: I need to know why this code has a flaw and what that flaw is. thank you Thumbs up. HW1B 1. Identify the problem(s) in

I need to know why this code has a flaw and what that flaw is. thank you Thumbs up.

I need to know why this code has a flaw and what

HW1B 1. Identify the problem(s) in the following code: #include #include #include void func() { char buffer[1024]; printf("Please enter your APSU user id :"); fgets(buffer, 1024, stdin); if (!isalpha(buffer[0])) { char errormsg(1044); strncpy(errormsg, buffer, 1924); Il guaranteed to be terminated strcat(errormsg, " is not a valid ID"); // we have room for this throw errormsg; } } int main() { try { func(); } catch (char * message) { fprintf(stderr, message); } return 0; } // line 32 2. What is the main issue with the above code? 3. Implement a defensive, secure solution

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!