flat assembler
Message board for the users of flat assembler.

Index > Main > is there a better way?

Author
Thread Post new topic Reply to topic
asmrox



Joined: 19 Jan 2008
Posts: 160
asmrox
sub esp,32
mov ebp,esp
mov dword [ebp],5
lea ecx,[ebp+4]
push 1
push 123
push ecx
call [something]
...


is there a better way to push address of buffer?[/b]
Post 09 May 2008, 15:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17492
Location: In your JS exploiting you and your system
revolution
asmrox wrote:
is there a better way to push address of buffer?
No, but it would look nicer (for you the programmer) if you used symbolic labels/symbols to show what all those fixed constants are meant to be.

Don't forget those [code] tags.
Post 09 May 2008, 15:17
View user's profile Send private message Visit poster's website Reply with quote
Frank



Joined: 17 Jun 2003
Posts: 100
Frank
Isn't that unnecessarily complicated? The following should do the same:

Code:
sub  esp, 28
mov  ecx, esp
push 5
push 1
push 123
push ecx
call [something]
...    
Post 09 May 2008, 19:27
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17492
Location: In your JS exploiting you and your system
revolution
Frank wrote:
Isn't that unnecessarily complicated? The following should do the same:

Code:
sub  esp, 28
mov  ecx, esp
push 5
push 1
push 123
push ecx
call [something]
...    
But we don't know what follows this code, we can't assume that setting ebp is not needed. You are using fixed constants also and assuming the original offset of +4 won't change.
Post 10 May 2008, 03:00
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2945
Location: vpcmipstrm
bitRAKE
Just for fun:
Code:
pushad
mov ebp,esp
pop ecx
mov ecx,esp
push 5
push 1
push 123
push ecx
call [something]    
...assuming buffer contents ignored/overwritten.

(this is post 666 for me, btw ) Laughing

_________________
¯\(°_o)/¯ unlicense.org
Post 10 May 2008, 05:49
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.