mercredi 25 octobre 2017

Different result after calling srand and rand in two similar executables

I have given a 32bit ELF binary. Meanwhile I created my own executable that does the same as the first one, to test the first one's behavior. The custom code outside of the library calls are very simple, as you can see.

The first executable:

mov     [esp], MySeed ; MySeed = 3255810Dh
call    _srand
call    _rand
; eax now holds 18C818C2h

The second executable, that I created:

push    3255810Dh                       ; seed
call    _srand
call    _rand
; eax now holds 7FFFFFFFh

I debugged them and they both use libc_2.23.so. I also put a breakpoint on _srand and _rand not to miss any hidden call to them, but no luck. They always came out with a different result.

What am I missing?




Aucun commentaire:

Enregistrer un commentaire