Feb 15, 2016 07:56 AM
(This post was last modified: Feb 15, 2016 08:23 AM by DarkETHOS.)
So with the following codes below for testing out buffer-overflow, why does the output of the variable name and command always come out different, is it due to the usage of memory not being 'static' - always flactuating? Variable name and command as in the address of 'Name' and 'Command'.
Tutorial is gotten from some guy on youtube, am still learning..
Tutorial is gotten from some guy on youtube, am still learning..
Quote:#include <stdio.h>
void main()
{
char *name;
char *command;
name=(char *)malloc(10);
command=(char *)malloc(128);
printf("address of Name is : %d\n", name);
printf("address of Command is : %d\n", command);
printf("Difference between address is : %d\n", command - name);
printf("Hey enter your name: ");
gets(name);
printf("Hello %s\n", name);
system(command);
}


