Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 8th, 2005, 11:55 PM   #1
Mad_guy
Hobbyist Programmer
 
Mad_guy's Avatar
 
Join Date: Oct 2004
Location: Sandstorm, Techno Club
Posts: 239
Rep Power: 5 Mad_guy is on a distinguished road
Send a message via AIM to Mad_guy Send a message via MSN to Mad_guy
Win money

Or not. This is just a question I want to see if anybody can answer.

The following code alters data, I want someone to tell me why it does this, and what the name of this kind of program exploit is called. This program won't die of segmentation fault either, so you can't say "It'll die of segmentation violation."

Code is as follows:
#include <stdio.h>
#include <malloc.h>
int main() {
     char *buf1=(char *)malloc(16),*buf2=(char *)malloc(16);
     memset(buf2,'A',15);
     printf("Before: %s\n",buf2);
     memset(buf1,'B',23);
     printf("After: %s",buf2);
getchar();
return 0;
}

First one to tell me, and get the right answer gets a prize.
Prize: [undecided]
Mad_guy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:48 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC