Buffer-overflow
Not what you're looking for?
Buffer-overflow is a common computer security concern. Write a simple program, in C, C++, and Java, to declare a simple one dimensional array and then attempt to access an array element that is not within its bounds. For example, what happens if I declare an array to be in studentNums[10] and then attempt to access studentNums[11], studentNums[12], or ..., studentNums[100] ?
Purchase this Solution
Solution Summary
To explain buffer-overflow computer security concern, a simple program is written, in C, C++, and Java, to declare a simple one dimensional array and then attempt to access an array element that is not within its bounds.
Solution Preview
In C/C++ the system does allow accessing an array element that is not within its bounds.
For instance this C/C++ code:
#include
#include
int main()
{
int studentNums[10] ;
memset ((void *)studentNums, 0x00, sizeof (studentNums)) ;
printf ("studentNums[9] = %dn", studentNums[9] ) ;
printf ("studentNums[10] = %dn", studentNums[10] ) ;
printf ("studentNums[11] = %dn", studentNums[11] ) ;
studentNums[11] = 11 ;
printf ("studentNums[11] = %dn", studentNums[11] ) ;
return 0;
}
outputs:
studentNums[9] = 0
studentNums[10] = ...
Purchase this Solution
Free BrainMass Quizzes
Javscript Basics
Quiz on basics of javascript programming language.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.
C++ Operators
This quiz tests a student's knowledge about C++ operators.
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.