Jonnycake Posted February 2, 2009 Share Posted February 2, 2009 Okay, so I was just messing around with some ASM (linux x86) and using the stack. I have a basic understanding of the stack, but can't figure out one thing. So, let's say I have this: .section .text .globl _start _start: pushl $0x0a414141 pushl $0x41 movl %esp,%ecx movl $8,%edx movl $4,%eax movl $1,%ebx int $0x80 movl $1,%eax movl $0,%ebx int $0x80 My question is why do i put the value 8 into edx instead of 5 since the actual string length is 5. I understand that each part of the stack holds 4 bytes (hence esp+4, esp+8, etc.), but I think it would just make more sense to have 5. I assume it's because with that the stack looks like: +8 0x0a414141 +4 0x00000041 +0 esp So you go from +4 and go forward 8 bytes ignoring the null bytes. Am I right in assuming this or is there another reason? Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.