Thread: Making Vulnerable Program Not Vulnerable

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    TheCMan
    Guest

    Question Making Vulnerable Program Not Vulnerable

    I have a program in C that is vulnerable to buffer overflow attacks. I need to understand how to make it not vulnerable to these attacks, and why the code added would do so-

    #include <stdio.h>


    #include <string.h>




    int main (int argn, char** argv) {
    char buffer[100];
    int i;
    long *addr_ptr; //a long is guaranteed to be a four-byte word
    strcp(buffer,argv[1]); //copies chars of argv[1] without bound
    addr_ptr = (long *) buffer;
    for (i = 0; i < 35; i++) {
    printf(“%02i:%08x:%08x\n”, //%08x displays hex chars
    i,(unsigned int) addr_ptr, (unsigned int) *addr_ptr);
    addr_ptr++;
    Last edited by TheCMan; 05-17-2019 at 01:36 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help making a program in C
    By 8494 in forum C Programming
    Replies: 1
    Last Post: 10-09-2015, 11:20 PM
  2. Help making a program
    By XtC10 in forum C++ Programming
    Replies: 9
    Last Post: 08-13-2010, 09:41 AM
  3. system() vulnerable to a buffer overflow?
    By Loic in forum C Programming
    Replies: 19
    Last Post: 08-12-2008, 05:33 PM
  4. Making a program that makes a program?
    By C-isCool in forum C Programming
    Replies: 3
    Last Post: 07-06-2007, 07:12 PM
  5. making a program leave a msg for background program when it closes
    By superflygizmo in forum Windows Programming
    Replies: 2
    Last Post: 02-06-2006, 07:44 PM

Tags for this Thread