You are on page 1of 3

BAHIR DAR UNIVERSITY

Bahirdar Institute of Technology (BiT)


Bsc in Software Engineering

Title: buffer over flow


Name ID

1. Alene Eyasu……………..0900152

Submitted to…………Kelmework(Msc)

Submission Date ……….. Based on agreement


#include <stdlib.h>

#include <stdio.h>

#include <string.h>

void myfun(char *str)

if ( (str == NULL) || (str.length < 0) || (str.length > 100) )

printf("Error... Enter you're Inputs Correctly");

if (str.length <= 100)

char buffer[100];

strcpy(buffer, str);

int main()

char str[500];

FILE *badfile;

badfile = fopen("badfile", "r");

fread(str, sizeof(char), 300, badfile);

myfun(str);

printf("Returned Properly");

return 1;

You might also like