OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: darko (darkoautistici.org)
Date: Mon Apr 08 2002 - 16:21:01 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Hi all,

    I've started to study buffer overflows. I wrote the following code:

    void f() {
            char a[4];
            int *b;
            b = a + 0x8;
            (*b) += 0x8;
    }

    main() {
            int x;
            x = 0;
            f();
            x = 1;
            printf("%d\n", x);
    }

    I want, after the call to f(), the program jump to printf() so the value of x
    should remain 0, not 1. I always get segmentation faults, bus errors, etc.
    and never that fuc*ing "x = 0" !!
    Tested on a Celeron 433, red hat 7.2, gcc 2.96.

    byez
    darko