Stack Allocations

From: msodaat_private
Date: Mon Jul 09 2001 - 06:27:10 PDT

  • Next message: Siberian: "List Site Pro, an intresting number of site "hacks""

    Hey all,
    
    I have been reading up on buffer overflows and have noticed something odd
    with gcc assembly output.  Consider the following:
    
    void func()
    {
       char buf[15];
    }
    
    main()
    {
       func();
    }
    
    When running 'gcc -S' it shows that 24 bytes are allocated on the stack
    for buf[].  I thought it should allocate only 16 bytes.  It works fine, it
    just makes no sense to me.  If I tweak the assembly and change it to 16
    bytes and also change the offsets to %ebp that reference it, it works fine
    also.
    
    Does anyone know why gcc does this?  My need to understand everything is
    killing me!
    
    -Marc
    



    This archive was generated by hypermail 2b30 : Mon Jul 09 2001 - 13:36:04 PDT