Ok below is a program we wrote in CS class. I found that by entering too many numbers, in this case 32 9's(bored) i caused a buffer overflow. Now in the sense of making BO's and DOS attacks and such i know that, but how can i adjust my program to allow that many numbers before the thing overflows? Is it my variable types?
Code:/* Steven Billington SumNum.cpp September 23, 2002 */ #include <iostream.h> #include <iomanip.h> const int MAIN_CONST = 5; int main () { int givenvalu,j,sum=0; for (j=1; j <=MAIN_CONST; ++j) { cout <<"Please enter a number and press <enter>: "; cin >>givenvalu; sum += givenvalu; } cout <<endl; cout <<"The sum of the given numbers is "<<sum<<endl; cout <<endl; cout <<"Goodbye!"<<endl; return 0; }