Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: buffer overflow

  1. #11
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    You know how we were talking about a return address from a function? Basically, you put your own code (can do anything you want it to do) into the memory and get its memory address. Then you do a buffer overflow and when you get to the return address "field", instead of putting crap in it, you put in the memory address of the code that you put into the memory yourself.

    This code can do whatever you want it to do, such as start a shell (quite a common one). But that's only an example.

    ac

  2. #12

    Smile

    Thanks for the explaination
    -n6

  3. #13
    Senior Member
    Join Date
    Oct 2001
    Posts
    872
    By: FallenZer0
    But, a person with a little bit of common sense would think, why don't the input get truncated if the user types more characters then was defined, instead of an overflow or a crash?
    I think the asnwers you got to this question were just too long. Basically, if you want the input to get truncated you, the coder, have to implicitly code something that will truncate input.

    Thus one of the reasoning behind fgets().

    Code:
    #include <stdio.h>
    
    int main() {
        int name[10];
    
        //gets(name);
        fgets(name, sizeof name, stdin); 
        printf("%s\n", name);
    
        return 0;
    }
    ...This Space For Rent.

    -[WebCarnage]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •