ThisisLegal Forums

Welcome to the forums! A chance for site members to chat and get help.

You are not logged in.

#1 2012-01-03 06:58:00

Registered: 2008-03-16
Posts: 45

C program | buffer overflow

This is  a simple C program but i am unable to decode  it .

<------------ C PROGRAM STARTS HERE ------------>
#include <stdio.h>
#include <string.h>
void echo(char* input) {
char buf[16];
strcpy(buf, input);
", buf);
int main(int argc, char **argv)
echo(argv[1]); // call the function to print the first 16 characters
return 0; // denote that the program has finished executing successfully
<------------ C PROGRAM ENDS HERE ------------->

the output of the above code is => segmentation fault:11
i want to know whether the above code is a victim of buffer overflow and if yes what is the exploit code and a basic explanation. thanx in advance smile


Board footer

Powered by FluxBB