All about programming in GNU/LINUX

A Simple code with a potential Buffer Vulnerability…(STRCPY is the vulnerable function here)

#include<stdio.h>
void welcome(char *str1,char *str2)
{
    char name[10];
    strcpy(name,str2);
    printf("\nhi %s %s ",str1,name);
}

int main(int argc,char *argv[])
{   //argv[1]="MR";
    //argv[2]="KARTHIK";
    welcome(argv[1],argv[2]);
    printf("BYE %s %s ",argv[1],argv[2]);
}














Advertisements

2 responses

  1. can you plz tell what the vulnerability is and how one can exploit it if used??

    October 5, 2011 at 11:48 am

    • This will be discussed this sunday in FSMK…….As u will be missing the session this week come , i explain it you wen we meet ..

      October 5, 2011 at 12:34 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s