I wrote a very simple c++ program to generate random string. And while execute the following code it gives 'stack smashing detected'.
#include<bits/stdc++.h>
#define SIZE 30
using namespace std;
int main() {
srand(time(0));
string str;
int len = rand() % SIZE;
for(int i = 0; i < len; i++) {
str[i] = (char)((rand() % 26) + 'a');
// cout<<str[i];
}
cout<<str<<endl<<"..."<<endl<<len<<endl;
}