Re: shellcode not executing if optimizations are on.

From: Luciano Miguel Ferreira Rocha (strangeat_private-ip.org)
Date: Wed Apr 30 2003 - 11:01:00 PDT

  • Next message: D.C. van Moolenbroek: "Re: Buffer overflow in Microsoft ftp.exe"

    On Wed, Apr 30, 2003 at 08:46:20AM -0700, wirepair wrote:
    <snip>
    > #include <stdio.h>
    > 
    > int main(int argc, char **argv) {
    > 	char shellcizode[] = 
    <snip>
    > 	((void (*)(void))&shellcizode)();
    <snip>
    > Now this only 
    > works IF optimizations are disabled. any hints??
    
    Most probably the compiler assumes that the shellcizode has no effect and
    removes the call.
    
    You could try defining shellcizode as volatile in order to disable any
    optimizations when dealing with it, or there may be some compiler pragma
    to disable optimizations in some places.
    
    Regards,
    Luciano Rocha
    



    This archive was generated by hypermail 2b30 : Wed Apr 30 2003 - 14:57:01 PDT