The stack layout


 
Thread Tools Search this Thread
Top Forums Programming The stack layout
# 1  
Old 10-16-2005
Question The stack layout

I try to solve the problem https://www.unix.com/showthread.php?p=86595 use stack hack method, I am puzzled the stack layout.
under vc6.0, the following code work(in release mode).
#include <stdio.h>

void change()
{
int x;
int j;
(&x)[3] = 5; // if in debug mode, change to (&x)[22] = 5;
}

int main()
{
int i = 10;
change();
printf("%d\n", i);
}

But in my FreeBSD box, whatever address I change, the i never change, except core dump when I run program.
Smilie Can any expert explain how the stack layout in system, for example, how does BSD system layout the stack and how does the Windows layout the stack?
Any response is appreciated.
# 2  
Old 10-17-2005
Hi ching,

I am also very much interested in knowing how is the memory layout for C.

Check this one out. It may be useful ..

https://www.unix.com/programming/22238-memory-layout-c-linux.html

Regards,
Parasa Kiran
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing table layout

Hi everyone, I'm a beginner in Unix, and would need some help from you guys! My input (pipe delimited): City|ZIP|Ref. Item NYC|212|00004 NYC|212|00032 NYC|212|00006 LA|90049|00068 LA|90049|00009 SF|94131|0027 You can see that the first 3 lines have column 1 and 2 in common, same for... (8 Replies)
Discussion started by: beca123456
8 Replies

2. UNIX for Dummies Questions & Answers

Kernel Stack vs User Mode Stack

Hi, I am new to the linux kernel development area. I want to know what is the difference between kernel mode stack and user mode stack? Does each process has a user mode stack and a kernel mode stack?? Or Each process has a user mode stack and there is only one kernel mode stack that is shared by... (4 Replies)
Discussion started by: saurabhkoar
4 Replies

3. AIX

cannot understand my disk layout

my users has requested more space to a particular volume group, so i do a lsvg honda:/tmp/ab/ecc # lsvg rootvg OP24BCKVG OP24ORAvg OP24SYSVG OP24DATVG the user wants to know what disks are available to be added to any of the vgs listed above, (not including rootvg) so i do a lspv... (2 Replies)
Discussion started by: asyed123
2 Replies

4. IP Networking

Questions about network layout

Hello all, thinking and reading of networks always make me think, and I have some questions, let me draw a sketch of the network I have, and then I'll put the questions: --->--->--->-->Hosts This is the big layout, now, the Linux Bridge has 3 NICS, two for making the bridge between the... (0 Replies)
Discussion started by: Zarnick
0 Replies

5. Programming

what is stack winding and stack unwinding

helo can u tell me what do you mean by stack winding and stack unwinding Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies

6. UNIX for Dummies Questions & Answers

Disk layout

Apologize if I hurt anyone's head with my questions, I'm entirely new to Unix and my office here doesn't offer any training just learn as you go. Anyways they asked me to get a disk layout of one of our servers and gave me this as an example the lables are assumptions Disk ... (2 Replies)
Discussion started by: newdigitalblue
2 Replies

7. SuSE

Keyboard Layout

ok, I am having a seriouse problem! I can not wite in my landguidge, I live in sweden but I seem to have an american keyboard layout so I cant write some letters and all the key commands are all messed up. Does anyone know where I can find a swedisch keyboard layout? (3 Replies)
Discussion started by: Kimm
3 Replies
Login or Register to Ask a Question