Question: Problem code: This code was created for and compiled by Visual C++ 6, which lacks security protection: //Winows Task Manager displays the memory leak with
Problem code:
This code was created for and compiled by Visual C++ 6, which lacks security protection:
//Winows Task Manager displays the memory leak with each iteration
#include
void main( void )
{
char buffer[200], s[] = "computer", c = 'l';
int i = 35, j;
float fp = 1.7320534f;
/* Format and print various data: */
printf("If this line is printed more than once then the IP has been modified. ");
j = sprintf( buffer, "\tString: %s ", s );
j += sprintf( buffer + j, "\tCharacter: %c ", c );
j += sprintf( buffer + j, "\tInteger: %d ", i );
j += sprintf( buffer + j, "\tReal: %f ", fp );
j += sprintf( buffer+j, "\t%s", "############################################################################abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" );
printf( "Output: %s character count = %d ", buffer, j );
First hypothesize what will happen when this runs. What will it do?
What action might you take to ensure that the code like the one from this exercise does not make it into your production (released) game application? How might you have to react to get a fix for code like this out to your users? What do the more recent versions of Visual Studio provide you to combat security issues?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
