CodeFlag
QuestionsPricing
TermsPrivacyCommercial Disclosure

Contact: ronantech@proton.me

© 2026 CodeFlag. All rights reserved.

CodeFlag
QuestionsPricing
securityeasyQuestion 81 of 137

User Input Buffer Handler

Review the following C++ code and flag the issue.

C++
1#include <cstdio>
2#include <cstring>
3
4void greet_user() {
5    char name[32];
6    printf("Enter your name: ");
7    char input[256];
8    fgets(input, sizeof(input), stdin);
9    strcpy(name, input);
10    printf("Hello, %s\n", name);
11}
TermsPrivacyCommercial Disclosure

Contact: ronantech@proton.me

© 2026 CodeFlag. All rights reserved.