Hello There, Guest! Login Register
Logo
Dismiss this notice
MaDLeeTs is not responsible for any attacks that are carried out on networks, websites or servers.
MaDLeeTs staff members cannot be held responsible.
All information on this forum is for educational purposes only.


overflow for C / C++

  • 0 Vote(s) - 0 Average


06-26-2012, 03:50 AM #1
Guest Unregistered
 
Mood: None
stack overflow Smiley1


Quote:#include<stdio.h>
#include <string.h>

GetInput(char * str)

{
char buffer[10];
strcpy(buffer,str);
printf("Your message is \"%s\"\n",buffer);

}


main( int argc, char *argv[] )

{
if( argc == 2 )

GetInput(argv[1]);
else
printf("Ops ?? One argument expected.\n");

return 0;

}

Quote:file.exe AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

06-26-2012, 04:28 AM #2
Tor Demon Offline MadLeets Vip ******
V.I.P
Posts:172 Threads:5 Joined:Jun 2012 Reputation: 0
Mood: None
nice tut Smiley1

06-26-2012, 07:27 AM #3
Guest Unregistered
 
Mood: None
ur welcome my broter Smiley1

06-27-2012, 12:23 AM #4
[email protected] Mind Offline MadLeeTs Staff **********
Junior Administrator
Posts:170 Threads:30 Joined:Jun 2012 Reputation: 3
Mood: None
Code:
#include<stdio.h> //header file input/output
#include <string.h> //header file for string functions

GetInput(char * str) //user defined function with argument character pointer named (str)

{
char buffer[10]; //character arrays name buffer size 10 bits

strcpy(buffer,str); //copy string value into buffer arrays

printf("Your message is \"%s\"\n",buffer); //simple print out

}


main( int argc, char *argv[] ) // command line arguments

{
if( argc == 2 ) // if user put anything. because the first argument is programm name and second will command

GetInput(argv[1]); //call userdefine function give argument value string value, The message user will put, will be string value
else

printf("Ops ?? One argument expected.\n"); //if user doesn't put anything then show this

return 0; //main program return 0

}//end main

Imperfection is beauty, madness is genius and it's better to be absolutely ridiculous than absolutely boring

06-27-2012, 12:34 AM #5
Guest Unregistered
 
Mood: None
yah broter Biggrinsmiley Thanks for the translation

06-27-2012, 12:37 AM #6
[email protected] Mind Offline MadLeeTs Staff **********
Junior Administrator
Posts:170 Threads:30 Joined:Jun 2012 Reputation: 3
Mood: None
i tried bro, am also not good translater, bad english Biggrinsmiley

Imperfection is beauty, madness is genius and it's better to be absolutely ridiculous than absolutely boring






Forum Jump:


Users browsing this thread:1 Guest(s)