Question: Given your program implementation, discuss and identify the possible vulnerabilities that may exist. If present, discuss solutions to minimize the vulnerabilities. Then discuss and identify
Given your program implementation, discuss and identify the possible vulnerabilities that may exist. If present, discuss solutions to minimize the vulnerabilities. Then discuss and identify possible problems that can result in errors for string manipulation of data.
Coding:
#include
using namespace std;
string reverse(string s) { string result; for (int i = 0; i < s.length(); ++i) { result += s[s.length() - i - 1]; } return result; }
int main() { string s; cout << "Welcome to the String Reversal Program "; cout << "Enter First Word: "; getline(cin, s); cout << "Reverse of \"" << s << "\" is \"" << reverse(s) << "\"" << endl;
cout << " Enter Second Word: "; getline(cin, s); cout << "Reverse of \"" << s << "\" is \"" << reverse(s) << "\"" << endl;
cout << " Enter Third Word: "; getline(cin, s); cout << "Reverse of \"" << s << "\" is \"" << reverse(s) << "\"" << endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
